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 | |
parent | 53167e975114b7bf60435949a57e5cae820ce503 (diff) |
upgrade from async-rustls to futures-rustls
Diffstat (limited to 'net')
-rw-r--r-- | net/Cargo.toml | 2 | ||||
-rw-r--r-- | net/src/error.rs | 4 | ||||
-rw-r--r-- | net/src/transports/tls.rs | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/net/Cargo.toml b/net/Cargo.toml index 5fecff5..6b816a8 100644 --- a/net/Cargo.toml +++ b/net/Cargo.toml @@ -14,4 +14,4 @@ log = "0.4.20" bincode = { version="2.0.0-rc.3", features = ["derive"]} thiserror = "1.0.47" url = "2.4.1" -async-rustls = { version = "0.4.1", features = ["dangerous_configuration"] } +futures-rustls = "0.25.1" diff --git a/net/src/error.rs b/net/src/error.rs index 0d96d64..be90a03 100644 --- a/net/src/error.rs +++ b/net/src/error.rs @@ -29,10 +29,10 @@ pub enum Error { ChannelRecv(#[from] smol::channel::RecvError), #[error("Tls Error: {0}")] - Rustls(#[from] async_rustls::rustls::Error), + Rustls(#[from] futures_rustls::rustls::Error), #[error("Invalid DNS Name: {0}")] - InvalidDnsNameError(#[from] async_rustls::rustls::client::InvalidDnsNameError), + InvalidDnsNameError(#[from] futures_rustls::pki_types::InvalidDnsNameError), #[error(transparent)] KaryonCore(#[from] karyon_core::error::Error), 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(..) => {} |