refactor: use rustls reexported from tokio_rustls

This commit is contained in:
link2xt
2025-10-13 16:46:48 +00:00
committed by l
parent 377f57f1c3
commit 0ab10f99fd
3 changed files with 2 additions and 4 deletions

1
Cargo.lock generated
View File

@@ -1346,7 +1346,6 @@ dependencies = [
"ratelimit",
"regex",
"rusqlite",
"rustls",
"rustls-pki-types",
"sanitize-filename",
"sdp",

View File

@@ -87,7 +87,6 @@ rand = { workspace = true }
regex = { workspace = true }
rusqlite = { workspace = true, features = ["sqlcipher"] }
rustls-pki-types = "1.12.0"
rustls = { version = "0.23.22", default-features = false }
sanitize-filename = { workspace = true }
sdp = "0.8.0"
serde_json = { workspace = true }

View File

@@ -35,10 +35,10 @@ pub async fn wrap_rustls<'a>(
alpn: &[&str],
stream: impl SessionStream + 'a,
) -> Result<impl SessionStream + 'a> {
let mut root_cert_store = rustls::RootCertStore::empty();
let mut root_cert_store = tokio_rustls::rustls::RootCertStore::empty();
root_cert_store.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
let mut config = rustls::ClientConfig::builder()
let mut config = tokio_rustls::rustls::ClientConfig::builder()
.with_root_certificates(root_cert_store)
.with_no_client_auth();
config.alpn_protocols = alpn.iter().map(|s| s.as_bytes().to_vec()).collect();