34 releases (17 breaking)
0.18.5 | Nov 15, 2023 |
---|---|
0.18.3 | Jul 8, 2023 |
0.16.1 | Jan 4, 2022 |
0.16.0 | Dec 30, 2021 |
0.7.0 | Jun 10, 2019 |
#209 in Network programming
72,690 downloads per month
Used in 19 crates
(8 directly)
14KB
172 lines
rustls-connector
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
~6–14MB
~258K SLoC