diff options
author | hozan23 <hozan23@proton.me> | 2024-03-12 21:54:29 +0100 |
---|---|---|
committer | hozan23 <hozan23@proton.me> | 2024-03-12 21:54:29 +0100 |
commit | 1126125d7088253e7a8751ca6ca31aa3af71aaa9 (patch) | |
tree | f0064f3a1b2e6c0fe460becc3e2898b38a50167c /net/src/transports | |
parent | 53167e975114b7bf60435949a57e5cae820ce503 (diff) |
upgrade from async-rustls to futures-rustls
Diffstat (limited to 'net/src/transports')
-rw-r--r-- | net/src/transports/tls.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/src/transports/tls.rs b/net/src/transports/tls.rs index 8a43d7d..83f7a11 100644 --- a/net/src/transports/tls.rs +++ b/net/src/transports/tls.rs @@ -1,7 +1,7 @@ use std::sync::Arc; -use async_rustls::{rustls, TlsAcceptor, TlsConnector, TlsStream}; use async_trait::async_trait; +use futures_rustls::{pki_types, rustls, TlsAcceptor, TlsConnector, TlsStream}; use smol::{ io::{split, AsyncReadExt, AsyncWriteExt, ReadHalf, WriteHalf}, lock::Mutex, @@ -63,7 +63,7 @@ pub async fn dial_tls( addr: &Addr, port: &Port, config: rustls::ClientConfig, - dns_name: &str, + dns_name: &'static str, ) -> Result<TlsConn> { let address = format!("{}:{}", addr, port); @@ -72,7 +72,7 @@ pub async fn dial_tls( let sock = TcpStream::connect(&address).await?; sock.set_nodelay(true)?; - let altname = rustls::ServerName::try_from(dns_name)?; + let altname = pki_types::ServerName::try_from(dns_name)?; let conn = connector.connect(altname, sock.clone()).await?; Ok(TlsConn::new(sock, TlsStream::Client(conn))) } @@ -81,7 +81,7 @@ pub async fn dial_tls( pub async fn dial( endpoint: &Endpoint, config: rustls::ClientConfig, - dns_name: &str, + dns_name: &'static str, ) -> Result<Box<dyn Connection>> { match endpoint { Endpoint::Tcp(..) | Endpoint::Tls(..) => {} |