39 releases (20 breaking)

0.21.0 May 2, 2024
0.19.2 Dec 6, 2023
0.18.5 Nov 15, 2023
0.18.3 Jul 8, 2023
0.7.0 Jun 10, 2019

#131 in Network programming

Download history 26143/week @ 2024-01-18 25552/week @ 2024-01-25 24459/week @ 2024-02-01 29560/week @ 2024-02-08 24063/week @ 2024-02-15 22415/week @ 2024-02-22 23956/week @ 2024-02-29 24594/week @ 2024-03-07 23702/week @ 2024-03-14 21636/week @ 2024-03-21 20782/week @ 2024-03-28 25759/week @ 2024-04-04 22332/week @ 2024-04-11 22615/week @ 2024-04-18 21876/week @ 2024-04-25 17013/week @ 2024-05-02

88,124 downloads per month
Used in 24 crates (9 directly)

BSD-2-Clause

14KB
167 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

Warning about crypto backends

A crypto implementation must be enabled in rustls using feature flags. We mimic what rustls does, providing one feature flag per implementation and enabling the same as rustls by default. Available options are:

  • rustls--aws_lc_rs (default)
  • rustls--ring

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

~7–23MB
~489K SLoC