#tls #rustls

rustls-connector

Connector similar to openssl or native-tls for rustls

28 releases (15 breaking)

Uses new Rust 2021

0.16.1 Jan 4, 2022
0.16.0 Dec 30, 2021
0.15.0 Oct 25, 2021
0.13.1 Dec 2, 2020
0.7.0 Jun 10, 2019

#644 in Network programming

Download history 2728/week @ 2022-03-01 3424/week @ 2022-03-08 3415/week @ 2022-03-15 3476/week @ 2022-03-22 3091/week @ 2022-03-29 3894/week @ 2022-04-05 2916/week @ 2022-04-12 3814/week @ 2022-04-19 3808/week @ 2022-04-26 4412/week @ 2022-05-03 5142/week @ 2022-05-10 3668/week @ 2022-05-17 4336/week @ 2022-05-24 4106/week @ 2022-05-31 4909/week @ 2022-06-07 3470/week @ 2022-06-14

17,389 downloads per month
Used in 12 crates (6 directly)

BSD-2-Clause

12KB
173 lines

rustls-connector

API Docs Build status Downloads

Connector similar to openssl or native-tls for rustls

rustls-connector is a library aiming at simplifying using rustls as an alternative to openssl and native-tls

Examples

To connect to a remote server:

use rustls_connector::RustlsConnector;

use std::{
    io::{Read, Write},
    net::TcpStream,
};

let connector = RustlsConnector::new_with_native_certs().unwrap();
let stream = TcpStream::connect("google.com:443").unwrap();
let mut stream = connector.connect("google.com", stream).unwrap();

stream.write_all(b"GET / HTTP/1.0\r\n\r\n").unwrap();
let mut res = vec![];
stream.read_to_end(&mut res).unwrap();
println!("{}", String::from_utf8_lossy(&res));

Dependencies

~5–12MB
~282K SLoC