[][src]Crate tokio_libtls

Async Tls bindings for libtls.

See also libtls for more information.

Note, the API for this crate is neither finished nor documented yet.

Example

async fn async_https_connect(servername: String) -> io::Result<()> {
    let request = format!(
        "GET / HTTP/1.1\r\n\
         Host: {}\r\n\
         Connection: close\r\n\r\n",
        servername
    );

    let config = TlsConfigBuilder::new().build()?;
    let mut tls = AsyncTls::connect(&(servername + ":443"), &config, None).await?;
    tls.write_all(request.as_bytes()).await?;

    let mut buf = vec![0u8; 1024];
    tls.read_exact(&mut buf).await?;

    let ok = b"HTTP/1.1 200 OK\r\n";
    assert_eq!(&buf[..ok.len()], ok);

    Ok(())
}

Modules

error

Error handling.

prelude

A "prelude" for crates using the tokio-libtls crate.

Structs

AsyncTls

Async Tls struct.

AsyncTlsOptions

Configuration options for AsyncTls.

TlsStream

Wrapper for async I/O operations with Tls.

Type Definitions

AsyncTlsStream

Pollable wrapper for async I/O operations with Tls.