Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Dec 9, 2023
1 parent 6dc7b8a commit c353ca9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ reqwest = { version = "0.11", default-features = false, features = [
] }
rustls = { version = "0.21", features = ["dangerous_configuration"] }
rustls-pemfile = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde = { version = "1.0.186", features = ["derive"] }
serde_json = "1.0"
socks5-impl = "0.5"
thiserror = "1.0"
tokio = { version = "1.34", features = ["full"] }
tokio = { version = "1.35", features = ["full"] }
tokio-rustls = "0.24"
tokio-tungstenite = { version = "0.20", features = ["rustls-tls-webpki-roots"] }
tokio-tungstenite = { version = "0.21", features = ["rustls-tls-webpki-roots"] }
trust-dns-proto = "0.23"
tungstenite = { version = "0.20", features = ["rustls-tls-webpki-roots"] }
tungstenite = { version = "0.21", features = ["rustls-tls-webpki-roots"] }
url = "2.4"
webpki = { package = "rustls-webpki", version = "0.101", features = [
"alloc",
Expand Down
13 changes: 5 additions & 8 deletions src/tls.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::error::{Error, Result};
use rustls_pemfile::{certs, rsa_private_keys};
use crate::error::Result;
use std::{
fs::File,
io::BufReader,
Expand Down Expand Up @@ -84,13 +83,11 @@ pub(crate) async fn create_tls_client_stream(
}

pub(crate) fn server_load_certs(path: &Path) -> Result<Vec<Certificate>> {
certs(&mut BufReader::new(File::open(path)?))
.map_err(|e| Error::from(format!("Certificate error: {e}")))
.map(|mut certs| certs.drain(..).map(Certificate).collect())
let certs = rustls_pemfile::certs(&mut BufReader::new(File::open(path)?))?;
Ok(certs.into_iter().map(Certificate).collect())
}

pub(crate) fn server_load_keys(path: &Path) -> Result<Vec<PrivateKey>> {
rsa_private_keys(&mut BufReader::new(File::open(path)?))
.map_err(|e| Error::from(format!("PrivateKey error: {e}")))
.map(|mut keys| keys.drain(..).map(PrivateKey).collect())
let keys = rustls_pemfile::rsa_private_keys(&mut BufReader::new(File::open(path)?))?;
Ok(keys.into_iter().map(PrivateKey).collect())
}

0 comments on commit c353ca9

Please sign in to comment.