Skip to content

Commit

Permalink
Bump alpha dependency versions
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto authored and djc committed Nov 26, 2023
1 parent 82d32c4 commit f48f8cc
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 13 deletions.
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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"] }
5 changes: 3 additions & 2 deletions examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down
2 changes: 1 addition & 1 deletion src/common/test_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,19 @@ impl TlsConnector {
}

#[inline]
pub fn connect<IO>(&self, domain: rustls::ServerName, stream: IO) -> Connect<IO>
pub fn connect<IO>(&self, domain: pki_types::ServerName<'static>, stream: IO) -> Connect<IO>
where
IO: AsyncRead + AsyncWrite + Unpin,
{
self.connect_with(domain, stream, |_| ())
}

pub fn connect_with<IO, F>(&self, domain: rustls::ServerName, stream: IO, f: F) -> Connect<IO>
pub fn connect_with<IO, F>(
&self,
domain: pki_types::ServerName<'static>,
stream: IO,
f: F,
) -> Connect<IO>
where
IO: AsyncRead + AsyncWrite + Unpin,
F: FnOnce(&mut ClientConnection),
Expand Down
2 changes: 1 addition & 1 deletion tests/badssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down
2 changes: 1 addition & 1 deletion tests/early-data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async fn send(
) -> io::Result<TlsStream<TcpStream>> {
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);
Expand Down
6 changes: 4 additions & 2 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn start_server() -> &'static (SocketAddr, &'static str, &'static [u8]) {
async fn start_client(addr: SocketAddr, domain: &str, config: Arc<ClientConfig>) -> 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()];

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit f48f8cc

Please sign in to comment.