#futures #rustls #async

futures-rustls

Asynchronous TLS/SSL streams for futures using Rustls

10 releases (5 breaking)

0.25.1 Jan 15, 2024
0.25.0 Dec 5, 2023
0.24.0 Apr 1, 2023
0.22.2 Aug 6, 2022
0.12.0-alpha Jun 1, 2019

#224 in Asynchronous

Download history 55423/week @ 2023-11-02 66332/week @ 2023-11-09 74662/week @ 2023-11-16 62225/week @ 2023-11-23 55793/week @ 2023-11-30 53881/week @ 2023-12-07 46034/week @ 2023-12-14 28575/week @ 2023-12-21 25743/week @ 2023-12-28 44338/week @ 2024-01-04 47907/week @ 2024-01-11 55274/week @ 2024-01-18 55482/week @ 2024-01-25 49772/week @ 2024-02-01 58798/week @ 2024-02-08 52993/week @ 2024-02-15

226,648 downloads per month
Used in 301 crates (26 directly)

MIT/Apache

52KB
1.5K SLoC

futures-rustls

crates docs.rs

Asynchronous TLS/SSL streams for futures using Rustls.

Basic Structure of a Client

use webpki::DNSNameRef;
use futures_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?;

// ...

License & Origin

This project is licensed under either of

at your option.

This started as a fork of tokio-rustls.

Contribution

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

Dependencies

~2–18MB
~294K SLoC