Skip to content

Commit cff0192

Browse files
committed
refactor: import tokio_rustls::rustls
1 parent 6f17a86 commit cff0192

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/net/tls.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use anyhow::Result;
77

88
use crate::net::session::SessionStream;
99

10+
use tokio_rustls::rustls;
1011
use tokio_rustls::rustls::client::ClientSessionStore;
1112

1213
pub async fn wrap_tls<'a>(
@@ -82,7 +83,7 @@ impl TlsSessionStore {
8283
.lock()
8384
.entry((port, alpn.to_string()))
8485
.or_insert_with(|| {
85-
Arc::new(tokio_rustls::rustls::client::ClientSessionMemoryCache::new(
86+
Arc::new(rustls::client::ClientSessionMemoryCache::new(
8687
TLS_CACHE_SIZE,
8788
))
8889
}),
@@ -98,10 +99,10 @@ pub async fn wrap_rustls<'a>(
9899
stream: impl SessionStream + 'a,
99100
tls_session_store: &TlsSessionStore,
100101
) -> Result<impl SessionStream + 'a> {
101-
let mut root_cert_store = tokio_rustls::rustls::RootCertStore::empty();
102+
let mut root_cert_store = rustls::RootCertStore::empty();
102103
root_cert_store.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
103104

104-
let mut config = tokio_rustls::rustls::ClientConfig::builder()
105+
let mut config = rustls::ClientConfig::builder()
105106
.with_root_certificates(root_cert_store)
106107
.with_no_client_auth();
107108
config.alpn_protocols = if alpn.is_empty() {
@@ -118,8 +119,8 @@ pub async fn wrap_rustls<'a>(
118119
// and are not worth increasing
119120
// attack surface: <https://words.filippo.io/we-need-to-talk-about-session-tickets/>.
120121
let resumption_store = tls_session_store.get(port, alpn);
121-
let resumption = tokio_rustls::rustls::client::Resumption::store(resumption_store)
122-
.tls12_resumption(tokio_rustls::rustls::client::Tls12Resumption::Disabled);
122+
let resumption = rustls::client::Resumption::store(resumption_store)
123+
.tls12_resumption(rustls::client::Tls12Resumption::Disabled);
123124
config.resumption = resumption;
124125
config.enable_sni = use_sni;
125126

0 commit comments

Comments
 (0)