From b4aa18277fd3d3a37a9714822be4878d565585ec Mon Sep 17 00:00:00 2001 From: Sander Maijers Date: Mon, 16 Jul 2018 12:50:05 +0200 Subject: [PATCH 1/2] Reexport deps This helps encapsulate deps and match crate versions for downstream use. --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 02dcf39..d1c6c7d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ //! Asynchronous TLS/SSL streams for Tokio using [Rustls](https://github.com/ctz/rustls). -extern crate rustls; -extern crate webpki; +pub extern crate rustls; +pub extern crate webpki; #[cfg(feature = "tokio")] mod tokio_impl; #[cfg(feature = "unstable-futures")] mod futures_impl; From 761696ad2219176bf56e52bddb08b7f2590d2867 Mon Sep 17 00:00:00 2001 From: Sander Maijers Date: Mon, 16 Jul 2018 14:05:38 +0200 Subject: [PATCH 2/2] Use reexported `rustls` deps in examples --- README.md | 3 +-- examples/client/Cargo.toml | 1 - examples/client/src/main.rs | 4 +--- examples/server/Cargo.toml | 1 - examples/server/src/main.rs | 10 +++++----- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 74997f1..da08405 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,7 @@ Asynchronous TLS/SSL streams for [Tokio](https://tokio.rs/) using ```rust use webpki::DNSNameRef; -use rustls::ClientConfig; -use tokio_rustls::ClientConfigExt; +use tokio_rustls::{ClientConfigExt, rustls::ClientConfig}; // ... diff --git a/examples/client/Cargo.toml b/examples/client/Cargo.toml index 6c4af55..acf13bd 100644 --- a/examples/client/Cargo.toml +++ b/examples/client/Cargo.toml @@ -4,7 +4,6 @@ version = "0.1.0" authors = ["quininer "] [dependencies] -rustls = "0.13" webpki = "0.18.1" tokio-rustls = { path = "../..", default-features = false, features = [ "tokio" ] } diff --git a/examples/client/src/main.rs b/examples/client/src/main.rs index 3bfc157..4673f47 100644 --- a/examples/client/src/main.rs +++ b/examples/client/src/main.rs @@ -1,5 +1,4 @@ extern crate clap; -extern crate rustls; extern crate tokio; extern crate webpki; extern crate webpki_roots; @@ -16,8 +15,7 @@ use tokio::io; use tokio::net::TcpStream; use tokio::prelude::*; use clap::{ App, Arg }; -use rustls::ClientConfig; -use tokio_rustls::ClientConfigExt; +use tokio_rustls::{ClientConfigExt, rustls::ClientConfig}; fn app() -> App<'static, 'static> { App::new("client") diff --git a/examples/server/Cargo.toml b/examples/server/Cargo.toml index bc4e6a8..98329ce 100644 --- a/examples/server/Cargo.toml +++ b/examples/server/Cargo.toml @@ -4,7 +4,6 @@ version = "0.1.0" authors = ["quininer "] [dependencies] -rustls = "0.13" tokio-rustls = { path = "../..", default-features = false, features = [ "tokio" ] } tokio = { version = "0.1.6" } diff --git a/examples/server/src/main.rs b/examples/server/src/main.rs index 8d1718a..c10f8ee 100644 --- a/examples/server/src/main.rs +++ b/examples/server/src/main.rs @@ -1,5 +1,4 @@ extern crate clap; -extern crate rustls; extern crate tokio; extern crate tokio_rustls; @@ -7,14 +6,15 @@ use std::sync::Arc; use std::net::ToSocketAddrs; use std::io::BufReader; use std::fs::File; -use rustls::{ Certificate, NoClientAuth, PrivateKey, ServerConfig }; -use rustls::internal::pemfile::{ certs, rsa_private_keys }; +use tokio_rustls::{ + ServerConfigExt, + rustls::{ Certificate, NoClientAuth, PrivateKey, ServerConfig, + internal::pemfile::{ certs, rsa_private_keys }}, +}; use tokio::prelude::{ Future, Stream }; use tokio::io::{ self, AsyncRead }; use tokio::net::TcpListener; use clap::{ App, Arg }; -use tokio_rustls::ServerConfigExt; - fn app() -> App<'static, 'static> { App::new("server")