Crates.io | fluvio-async-tls |
lib.rs | fluvio-async-tls |
version | 0.3.0 |
source | src |
created_at | 2020-10-28 00:04:53.534735 |
updated_at | 2022-06-21 17:13:44.457668 |
description | Asynchronous TLS/SSL streams using Rustls. |
homepage | https://github.com/async-std/async-tls |
repository | https://github.com/async-std/async-tls |
max_upload_size | |
id | 306169 |
size | 79,114 |
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"]
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?;
// ...
See examples/client. You can run it with:
cd examples/client
cargo run -- hsts.badssl.com
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!
This crate uses #![deny(unsafe_code)]
to ensure everything is implemented in
100% Safe Rust.
This project is licensed under either of
at your option.
This started as a fork of tokio-rustls.
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.