55 releases

0.14.0 Jul 5, 2020
0.13.0 Feb 23, 2020
0.12.3 May 19, 2020
0.12.1 Dec 8, 2019
0.1.6 Mar 31, 2017

#6 in Asynchronous

Download history 37385/week @ 2020-04-21 40168/week @ 2020-04-28 39065/week @ 2020-05-05 45850/week @ 2020-05-12 41211/week @ 2020-05-19 44836/week @ 2020-05-26 59337/week @ 2020-06-02 56280/week @ 2020-06-09 47113/week @ 2020-06-16 52379/week @ 2020-06-23 46776/week @ 2020-06-30 47122/week @ 2020-07-07 47208/week @ 2020-07-14 48453/week @ 2020-07-21 50472/week @ 2020-07-28 48464/week @ 2020-08-04

189,378 downloads per month
Used in 723 crates (80 directly)

MIT/Apache

47KB
1K SLoC

tokio-rustls

github actions crates license license docs.rs

Asynchronous TLS/SSL streams for Tokio using Rustls.

Basic Structure of a Client

use webpki::DNSNameRef;
use tokio_rustls::{ TlsConnector, rustls::ClientConfig };

// ...

let mut config = ClientConfig::new();
config.root_store.add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
let config = TlsConnector::from(Arc::new(config));
let dnsname = DNSNameRef::try_from_ascii_str("www.rust-lang.org").unwrap();

let stream = TcpStream::connect(&addr).await?;
let mut stream = config.connect(dnsname, stream).await?;

// ...

Client Example Program

See examples/client. You can run it with:

cd examples/client
cargo run -- hsts.badssl.com

Server Example Program

See examples/server. You can run it with:

cd examples/server
cargo run -- 127.0.0.1 --cert mycert.der --key mykey.der

License & Origin

This project is licensed under either of

at your option.

This started as a fork of tokio-tls.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in tokio-rustls by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~9.5MB
~240K SLoC