Skip to content

amqp-rs/async-openssl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

137 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Docs Build status Downloads Dependency Status LICENSE

Async TLS streams backed by OpenSSL.

Provides SslStream, an async wrapper around openssl::ssl::SslStream that implements futures_io::AsyncRead and futures_io::AsyncWrite instead of the blocking std::io::Read / std::io::Write traits, making it usable with any runtime that builds on the futures-io ecosystem.

Forked from tokio-openssl and reworked to target the runtime-agnostic futures-io traits rather than the tokio-specific ones.

Example

use async_openssl::SslStream;
use openssl::ssl::{SslConnector, SslMethod};
use std::pin::Pin;

async fn connect(host: &str) -> Result<(), Box<dyn std::error::Error>> {
    use smol::net::TcpStream;

    let connector = SslConnector::builder(SslMethod::tls())?.build();
    let stream = TcpStream::connect((host, 443u16)).await?;
    let ssl = connector.configure()?.into_ssl(host)?;
    let mut stream = SslStream::new(ssl, stream)?;
    Pin::new(&mut stream).connect().await?;
    Ok(())
}

For a complete runnable example see examples/.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

About

OpenSSL async bindings

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Rust 100.0%