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

github.com/chatmail/async-native-tls @v0.6.0

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

async-native-tls

Asynchronous Native TLS

Crates.io version

Download

docs.rs docs

API Docs | Releases

Native TLS for async-std or tokio.

This crate uses SChannel on Windows (via schannel), Secure Transport on OSX (via security-framework), and OpenSSL (via openssl) on all other platforms.

Installation

$ cargo add async-native-tls

Cargo Feature Flags

  • runtime-smol (on by default): Use the smol runtime.

  • runtime-tokio: Use the tokio runtime. This is mutually exclusive with runtime-smol.

Example

smol

Requires runtime-smol feature (on by default).

# Cargo.toml
[dependencies]
async-native-tls = "0.4"
use smol::prelude::*;
use smol::net::TcpStream;

let stream = TcpStream::connect("google.com:443").await?;
let mut stream = async_native_tls::connect("google.com", stream).await?;
stream.write_all(b"GET / HTTP/1.0\r\n\r\n").await?;

let mut res = Vec::new();
stream.read_to_end(&mut res).await?;
println!("{}", String::from_utf8_lossy(&res));

tokio

Requires runtime-tokio feature.

# Cargo.toml
[dependencies]
async-native-tls = { version = "0.4", default-features = false, features = [ "runtime-tokio" ] }
use tokio::prelude::*;
use tokio::net::TcpStream;

let stream = TcpStream::connect("google.com:443").await?;
let mut stream = async_native_tls::connect("google.com", stream).await?;
stream.write_all(b"GET / HTTP/1.0\r\n\r\n").await?;

let mut res = Vec::new();
stream.read_to_end(&mut res).await?;
println!("{}", String::from_utf8_lossy(&res));

Contributing

Want to join us? Check out our "Contributing" guide and take a look at some of these issues:

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

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

Core symbols most depended-on inside this repo

get_mut
called by 7
src/tls_stream.rs
with_context
called by 6
src/tls_stream.rs
with_context
called by 4
src/std_adapter.rs
cvt
called by 4
src/tls_stream.rs
get_host
called by 4
tests/bad.rs
connect
called by 3
src/lib.rs
connect
called by 3
src/lib.rs
read
called by 2
src/std_adapter.rs

Shape

Method 39
Function 17
Class 11
Enum 2

Languages

Rust100%

Modules by API surface

src/lib.rs18 symbols
src/tls_stream.rs16 symbols
src/acceptor.rs7 symbols
tests/smoke.rs6 symbols
src/handshake.rs6 symbols
tests/bad.rs5 symbols
src/std_adapter.rs5 symbols
src/connector.rs4 symbols
tests/google.rs1 symbols
tests/google-tokio.rs1 symbols

For agents

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

⬇ download graph artifact