[−][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
use std::io; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio_libtls::prelude::{connect, Builder}; 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 = Builder::new().build()?; let mut tls = 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 |
Structs
AsyncTls | Async |
Options | Configuration options for |
TlsStream | Wrapper for async I/O operations with |
Functions
accept | Accept a new async |
accept_stream | Accept a new async |
connect | Connect a new async |
connect_stream | Upgrade a TCP stream to a new async |
Type Definitions
AsyncTlsOptions | Deprecated Configuration options for |
AsyncTlsStream | Pollable wrapper for async I/O operations with |