From c918da906bea572477f1a75c1f31240aabc8b20b Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Thu, 4 Feb 2021 15:22:38 +0000 Subject: [PATCH] use reexported tls crates when possible --- actix-tls/Cargo.toml | 9 ++------- actix-tls/examples/basic.rs | 4 ++-- actix-tls/src/accept/nativetls.rs | 2 +- actix-tls/src/accept/rustls.rs | 2 +- actix-tls/src/connect/ssl/rustls.rs | 4 ++-- actix-tls/src/lib.rs | 4 ---- 6 files changed, 8 insertions(+), 17 deletions(-) diff --git a/actix-tls/Cargo.toml b/actix-tls/Cargo.toml index aa5f0c89..61853b60 100755 --- a/actix-tls/Cargo.toml +++ b/actix-tls/Cargo.toml @@ -31,10 +31,10 @@ connect = [] openssl = ["tls-openssl", "tokio-openssl"] # use rustls impls -rustls = ["tls-rustls", "webpki", "webpki-roots", "tokio-rustls"] +rustls = ["tokio-rustls", "webpki-roots"] # use native-tls impls -native-tls = ["tls-native-tls", "tokio-native-tls"] +native-tls = ["tokio-native-tls"] # support http::Uri as connect address uri = ["http"] @@ -55,16 +55,11 @@ tokio-util = { version = "0.6.3", default-features = false } tls-openssl = { package = "openssl", version = "0.10", optional = true } tokio-openssl = { version = "0.6", optional = true } -# TODO: Reduce dependencies where tokio wrappers re-export base crate. - # rustls -tls-rustls = { package = "rustls", version = "0.19", optional = true } tokio-rustls = { version = "0.22", optional = true } -webpki = { version = "0.21", optional = true } webpki-roots = { version = "0.21", optional = true } # native-tls -tls-native-tls = { package = "native-tls", version = "0.2", optional = true } tokio-native-tls = { version = "0.3", optional = true } [dev-dependencies] diff --git a/actix-tls/examples/basic.rs b/actix-tls/examples/basic.rs index 3f4cdb24..d1762b08 100644 --- a/actix-tls/examples/basic.rs +++ b/actix-tls/examples/basic.rs @@ -15,9 +15,9 @@ //! http --verify=false https://127.0.0.1:8443 //! ``` -// this rename only exists because of how we have organised the crate's feature flags +// this use only exists because of how we have organised the crate // it is not necessary for your actual code -extern crate tls_rustls as rustls; +use tokio_rustls::rustls; use std::{ env, diff --git a/actix-tls/src/accept/nativetls.rs b/actix-tls/src/accept/nativetls.rs index 73090de6..236ce973 100644 --- a/actix-tls/src/accept/nativetls.rs +++ b/actix-tls/src/accept/nativetls.rs @@ -5,7 +5,7 @@ use actix_service::{Service, ServiceFactory}; use actix_utils::counter::Counter; use futures_core::future::LocalBoxFuture; -pub use native_tls::Error; +pub use tokio_native_tls::native_tls::Error; pub use tokio_native_tls::{TlsAcceptor, TlsStream}; use super::MAX_CONN_COUNTER; diff --git a/actix-tls/src/accept/rustls.rs b/actix-tls/src/accept/rustls.rs index c65d4657..ff5cf3e5 100644 --- a/actix-tls/src/accept/rustls.rs +++ b/actix-tls/src/accept/rustls.rs @@ -12,7 +12,7 @@ use actix_utils::counter::{Counter, CounterGuard}; use futures_core::future::LocalBoxFuture; use tokio_rustls::{Accept, TlsAcceptor}; -pub use rustls::{ServerConfig, Session}; +pub use tokio_rustls::rustls::{ServerConfig, Session}; pub use tokio_rustls::server::TlsStream; use super::MAX_CONN_COUNTER; diff --git a/actix-tls/src/connect/ssl/rustls.rs b/actix-tls/src/connect/ssl/rustls.rs index 9bb5f80f..811c7adc 100755 --- a/actix-tls/src/connect/ssl/rustls.rs +++ b/actix-tls/src/connect/ssl/rustls.rs @@ -6,7 +6,7 @@ use std::{ task::{Context, Poll}, }; -pub use rustls::Session; +pub use tokio_rustls::rustls::Session; pub use tokio_rustls::{client::TlsStream, rustls::ClientConfig}; pub use webpki_roots::TLS_SERVER_ROOTS; @@ -15,7 +15,7 @@ use actix_service::{Service, ServiceFactory}; use futures_core::{future::LocalBoxFuture, ready}; use log::trace; use tokio_rustls::{Connect, TlsConnector}; -use webpki::DNSNameRef; +use tokio_rustls::webpki::DNSNameRef; use crate::connect::{Address, Connection}; diff --git a/actix-tls/src/lib.rs b/actix-tls/src/lib.rs index 1fa08b6b..83e18d58 100644 --- a/actix-tls/src/lib.rs +++ b/actix-tls/src/lib.rs @@ -4,12 +4,8 @@ #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] -#[cfg(feature = "native-tls")] -extern crate tls_native_tls as native_tls; #[cfg(feature = "openssl")] extern crate tls_openssl as openssl; -#[cfg(feature = "rustls")] -extern crate tls_rustls as rustls; #[cfg(feature = "accept")] pub mod accept;