[][src]Crate 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));

Re-exports

pub use rustls;
pub use rustls_native_certs;
pub use webpki;
pub use webpki_roots;

Structs

MidHandshakeTlsStream

A TLS stream which has been interrupted during the handshake

RustlsConnector

The connector

RustlsConnectorConfig

Configuration helper for RustlsConnector

Enums

HandshakeError

An error returned while performing the handshake

Type Definitions

TlsStream

A TLS stream