6 releases (breaking)

0.9.0 Jul 15, 2020
0.8.0 Jul 9, 2020
0.7.1 Jul 8, 2020
0.7.0 Mar 30, 2020
0.1.0 May 31, 2019

#8 in Asynchronous

Download history 6215/week @ 2020-04-21 5623/week @ 2020-04-28 6520/week @ 2020-05-05 8879/week @ 2020-05-12 6535/week @ 2020-05-19 6993/week @ 2020-05-26 7398/week @ 2020-06-02 7276/week @ 2020-06-09 7752/week @ 2020-06-16 7250/week @ 2020-06-23 8018/week @ 2020-06-30 8103/week @ 2020-07-07 8230/week @ 2020-07-14 10224/week @ 2020-07-21 10466/week @ 2020-07-28 9829/week @ 2020-08-04

30,872 downloads per month
Used in 74 crates (18 directly)

MIT/Apache

44KB
973 lines

async-tls

Async TLS/SSL streams using Rustls.


Features

async-tls can be used both in server and client programs. To save compilation times, you can switch off parts of this for faster compile times.

To only use async-tls on a client, deactivate default features and use the "client" feature.

[dependencies.async-tls]
version = "0.8"
default-features = false
features = ["client"]

To only use async-tls on for the server side, deactivate default features and use the "server" feature.

[dependencies.async-tls]
version = "0.8"
default-features = false
features = ["server"]

Simple Client

use async_tls::TlsConnector;
use async_std::net::TcpStream;

// ...

let tcp_stream = TcpStream::connect("rust-lang.org:443").await?;
let connector = TlsConnector::default();
let mut tls_stream = connector.connect("www.rust-lang.org", tcp_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:8080 --cert ../../tests/end.cert --key ../../tests/end.rsa

and point the client at it with:

cd examples/client
cargo run -- 127.0.0.1 --port 8080 --domain localhost --cafile ../../tests/end.chain

NOTE: Don't ever use those certificate files anywhere but for testing!

Safety

This crate uses #![deny(unsafe_code)] to ensure everything is implemented in 100% Safe Rust.

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 async-tls by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~9MB
~242K SLoC