From 05cda5fed0e1db16a746dc03f693c1d672bb81a5 Mon Sep 17 00:00:00 2001 From: tottoto Date: Sat, 25 Nov 2023 21:05:50 +0900 Subject: [PATCH] Bump alpha dependency versions --- Cargo.toml | 9 +++++---- examples/client.rs | 5 +++-- src/common/test_stream.rs | 2 +- src/lib.rs | 9 +++++++-- tests/badssl.rs | 2 +- tests/early-data.rs | 2 +- tests/test.rs | 6 ++++-- 7 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0e9c40c0..752aa947 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,8 @@ exclude = ["/.github", "/examples", "/scripts"] [dependencies] tokio = "1.0" -rustls = { version = "=0.22.0-alpha.4", default-features = false } +rustls = { version = "=0.22.0-alpha.5", default-features = false } +pki-types = { package = "rustls-pki-types", version = "0.2.2" } [features] default = ["logging", "tls12", "ring"] @@ -28,6 +29,6 @@ argh = "0.1.1" tokio = { version = "1.0", features = ["full"] } futures-util = "0.3.1" lazy_static = "1.1" -webpki-roots = "=0.26.0-alpha.1" -rustls-pemfile = "=2.0.0-alpha.1" -webpki = { package = "rustls-webpki", version = "=0.102.0-alpha.6", features = ["alloc", "std"] } +webpki-roots = "=0.26.0-alpha.2" +rustls-pemfile = "=2.0.0-alpha.2" +webpki = { package = "rustls-webpki", version = "=0.102.0-alpha.7", features = ["alloc", "std"] } diff --git a/examples/client.rs b/examples/client.rs index 8c2c5171..1a301abc 100644 --- a/examples/client.rs +++ b/examples/client.rs @@ -61,8 +61,9 @@ async fn main() -> io::Result<()> { let (mut stdin, mut stdout) = (tokio_stdin(), tokio_stdout()); - let domain = rustls::ServerName::try_from(domain.as_str()) - .map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "invalid dnsname"))?; + let domain = pki_types::ServerName::try_from(domain.as_str()) + .map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "invalid dnsname"))? + .to_owned(); let mut stream = connector.connect(domain, stream).await?; stream.write_all(content.as_bytes()).await?; diff --git a/src/common/test_stream.rs b/src/common/test_stream.rs index d58eabc0..dbd9a233 100644 --- a/src/common/test_stream.rs +++ b/src/common/test_stream.rs @@ -284,7 +284,7 @@ fn make_pair() -> (ServerConnection, ClientConnection) { let (sconfig, cconfig) = utils::make_configs(); let server = ServerConnection::new(sconfig).unwrap(); - let domain = rustls::ServerName::try_from("foobar.com").unwrap(); + let domain = pki_types::ServerName::try_from("foobar.com").unwrap(); let client = ClientConnection::new(cconfig, domain).unwrap(); (server, client) diff --git a/src/lib.rs b/src/lib.rs index 8a2d2b98..ccf7f7e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -106,14 +106,19 @@ impl TlsConnector { } #[inline] - pub fn connect(&self, domain: rustls::ServerName, stream: IO) -> Connect + pub fn connect(&self, domain: pki_types::ServerName<'static>, stream: IO) -> Connect where IO: AsyncRead + AsyncWrite + Unpin, { self.connect_with(domain, stream, |_| ()) } - pub fn connect_with(&self, domain: rustls::ServerName, stream: IO, f: F) -> Connect + pub fn connect_with( + &self, + domain: pki_types::ServerName<'static>, + stream: IO, + f: F, + ) -> Connect where IO: AsyncRead + AsyncWrite + Unpin, F: FnOnce(&mut ClientConnection), diff --git a/tests/badssl.rs b/tests/badssl.rs index b41b55f0..1430d635 100644 --- a/tests/badssl.rs +++ b/tests/badssl.rs @@ -19,7 +19,7 @@ async fn get( let input = format!("GET / HTTP/1.0\r\nHost: {}\r\n\r\n", domain); let addr = (domain, port).to_socket_addrs()?.next().unwrap(); - let domain = rustls::ServerName::try_from(domain).unwrap(); + let domain = pki_types::ServerName::try_from(domain).unwrap().to_owned(); let mut buf = Vec::new(); let stream = TcpStream::connect(&addr).await?; diff --git a/tests/early-data.rs b/tests/early-data.rs index ed863847..20b258bb 100644 --- a/tests/early-data.rs +++ b/tests/early-data.rs @@ -44,7 +44,7 @@ async fn send( ) -> io::Result> { let connector = TlsConnector::from(config).early_data(true); let stream = TcpStream::connect(&addr).await?; - let domain = rustls::ServerName::try_from("foobar.com").unwrap(); + let domain = pki_types::ServerName::try_from("foobar.com").unwrap(); let stream = connector.connect(domain, stream).await?; let (mut rd, mut wd) = split(stream); diff --git a/tests/test.rs b/tests/test.rs index fceac163..b6423843 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -86,7 +86,7 @@ fn start_server() -> &'static (SocketAddr, &'static str, &'static [u8]) { async fn start_client(addr: SocketAddr, domain: &str, config: Arc) -> io::Result<()> { const FILE: &[u8] = include_bytes!("../README.md"); - let domain = rustls::ServerName::try_from(domain).unwrap(); + let domain = pki_types::ServerName::try_from(domain).unwrap().to_owned(); let config = TlsConnector::from(config); let mut buf = vec![0; FILE.len()]; @@ -154,7 +154,9 @@ async fn test_lazy_config_acceptor() -> io::Result<()> { let (sconfig, cconfig) = utils::make_configs(); let (cstream, sstream) = tokio::io::duplex(1200); - let domain = rustls::ServerName::try_from("foobar.com").unwrap(); + let domain = pki_types::ServerName::try_from("foobar.com") + .unwrap() + .to_owned(); tokio::spawn(async move { let connector = crate::TlsConnector::from(cconfig); let mut client = connector.connect(domain, cstream).await.unwrap();