Crate libtls [] [src]

This library crate provides mid-level bindings to the libtls API, provided by OpenBSD's libressl.

Example

use std::io::prelude::*;
use libtls::*;
let init = Init::init();
let mut config = Config::new(init);
config.insecure_noverifycert();
let mut stream = config
    .connect(("google.com", 443))
    .expect("connection failed");
let mut buf = vec![0; 32];
stream.write(&mut buf).expect("write failed");
stream.close().expect("close failed");

Structs

Ciphers

A list of enabled encryption algorithms.

Config

A TLS connection builder.

Init

The global TLS context. This object exists to represent the global state in libtls. Retrieving another instance with Init::init() is not that expensive, but copying it is free and it has zero size.

Protocols

A list of enabled TLS protocols. Pass this to Config::set_protocols

Stream

A TLS connection.

Enums

ConnectError

Errors that can result from running one of the Config::Connect functions.

Traits

ToNamedSocketAddrs

This is a variant of ToSocketAddrs that provides a name to verify with.