confab 0.2.0

Asynchronous line-oriented interactive TCP client
1
2
3
4
5
6
7
8
9
10
11
12
13
use anyhow::Context;
use tokio::net::TcpStream;

pub(crate) type TlsStream = tokio_native_tls::TlsStream<TcpStream>;

pub(crate) async fn connect(conn: TcpStream, servername: &str) -> anyhow::Result<TlsStream> {
    tokio_native_tls::TlsConnector::from(
        native_tls::TlsConnector::new().context("Error creating TLS connector")?,
    )
    .connect(servername, conn)
    .await
    .context("Error establishing TLS connection")
}