MCPcopy Index your code
hub / github.com/async-rs/async-tls

github.com/async-rs/async-tls @v0.13.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.13.0 ↗ · + Follow
99 symbols 266 edges 15 files 11 documented · 11%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

async-tls

Async TLS/SSL streams using Rustls.

Crates.io version

Download

docs.rs docs

chat

API Docs | Releases | Contributing

Maintenance Notice

I, Florian Gilcher, am currently the main maintainer of async-tls. Due to general workload, I would like the hand the maintenance off to someone else carrying the general vision of async-tls:

  • Runtime-independence
  • Backend-independence (currently not implemented)
  • Focused on use-case based configuration rather then exposing all configurations

I expect applicants for maintainership to present a committment of at least 4h of time/week initially, so I recommend getting corporate backing first. The number isn't strict, but I want the process to improve maintenance. I'm happy with a group of multiple maintainers.

I commit to weekly feedback of 30 minutes for the first 2 months - more in the initial days of handover.

If interested, please reach out to me at through email.

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

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

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.

Extension points exported contracts — how you extend this code

WriteTls (Interface)
(no doc) [1 implementers]
src/rusttls/stream.rs

Core symbols most depended-on inside this repo

get_mut
called by 15
src/client.rs
set_eof
called by 11
src/rusttls/stream.rs
readable
called by 11
src/common/tls_state.rs
as_mut_pin
called by 10
src/rusttls/stream.rs
wants_write
called by 7
src/rusttls/stream.rs
send_close_notify
called by 7
src/rusttls/stream.rs
is_handshaking
called by 6
src/rusttls/stream.rs
connect
called by 4
src/connector.rs

Shape

Method 57
Function 22
Class 13
Enum 6
Interface 1

Languages

Rust100%

Modules by API surface

src/rusttls/stream.rs32 symbols
src/rusttls/test_stream.rs14 symbols
src/connector.rs10 symbols
src/client.rs9 symbols
src/server.rs7 symbols
src/acceptor.rs6 symbols
examples/server/src/main.rs6 symbols
src/common/tls_state.rs5 symbols
tests/test.rs4 symbols
examples/client/src/main.rs3 symbols
src/test_0rtt.rs2 symbols
tests/google.rs1 symbols

For agents

$ claude mcp add async-tls \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page