Skip to content

Commit

Permalink
Use rustls via tokio-rustls re-export
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrubeck committed Mar 7, 2024
1 parent 75cf602 commit df41668
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ mime_guess = "2.0"
once_cell = "1.19"
percent-encoding = "2.3"
rcgen = { version = "0.12.1", default-features = false, features = ["ring"] }
rustls = "0.22.2"
tokio-rustls = "0.25.0"
tokio-rustls = { version = "0.25.0", default-features = false, features = ["logging", "ring", "tls12"] }
tokio = { version = "1.36", features = ["fs", "io-util", "net", "rt-multi-thread", "sync"] }
url = "2.5.0"

Expand Down
13 changes: 7 additions & 6 deletions src/certificates.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
use {
rustls::{
crypto::ring::sign::any_supported_type,
pki_types::{self, CertificateDer, PrivateKeyDer},
server::{ClientHello, ResolvesServerCert},
sign::{CertifiedKey, SigningKey},
},
std::{
ffi::OsStr,
fmt::{Display, Formatter},
path::Path,
sync::Arc,
},
tokio_rustls::rustls::{
self,
crypto::ring::sign::any_supported_type,
pki_types::{self, CertificateDer, PrivateKeyDer},
server::{ClientHello, ResolvesServerCert},
sign::{CertifiedKey, SigningKey},
},
};

/// A struct that holds all loaded certificates and the respective domain
Expand Down
9 changes: 6 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use {
once_cell::sync::Lazy,
percent_encoding::{percent_decode_str, percent_encode, AsciiSet, CONTROLS},
rcgen::{Certificate, CertificateParams, DnType},
rustls::server::ServerConfig,
std::{
borrow::Cow,
error::Error,
Expand All @@ -28,7 +27,11 @@ use {
runtime::Runtime,
sync::Mutex,
},
tokio_rustls::{server::TlsStream, TlsAcceptor},
tokio_rustls::{
rustls::{server::ServerConfig, version::TLS13},
server::TlsStream,
TlsAcceptor,
},
url::{Host, Url},
};

Expand Down Expand Up @@ -408,7 +411,7 @@ static TLS: Lazy<TlsAcceptor> = Lazy::new(acceptor);

fn acceptor() -> TlsAcceptor {
let config = if ARGS.only_tls13 {
ServerConfig::builder_with_protocol_versions(&[&rustls::version::TLS13])
ServerConfig::builder_with_protocol_versions(&[&TLS13])
} else {
ServerConfig::builder()
}
Expand Down
1 change: 1 addition & 0 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::net::{SocketAddr, ToSocketAddrs};
use std::path::PathBuf;
use std::process::{Command, Stdio};
use std::sync::atomic::{AtomicU16, Ordering};
use tokio_rustls::rustls;
use url::Url;

static BINARY_PATH: &str = env!("CARGO_BIN_EXE_agate");
Expand Down

0 comments on commit df41668

Please sign in to comment.