1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-12-02 19:52:24 +01:00

use reexported tls crates when possible

This commit is contained in:
Rob Ede 2021-02-04 15:22:38 +00:00
parent b5399c5631
commit c918da906b
No known key found for this signature in database
GPG Key ID: C2A3B36E841A91E6
6 changed files with 8 additions and 17 deletions

View File

@ -31,10 +31,10 @@ connect = []
openssl = ["tls-openssl", "tokio-openssl"] openssl = ["tls-openssl", "tokio-openssl"]
# use rustls impls # use rustls impls
rustls = ["tls-rustls", "webpki", "webpki-roots", "tokio-rustls"] rustls = ["tokio-rustls", "webpki-roots"]
# use native-tls impls # use native-tls impls
native-tls = ["tls-native-tls", "tokio-native-tls"] native-tls = ["tokio-native-tls"]
# support http::Uri as connect address # support http::Uri as connect address
uri = ["http"] uri = ["http"]
@ -55,16 +55,11 @@ tokio-util = { version = "0.6.3", default-features = false }
tls-openssl = { package = "openssl", version = "0.10", optional = true } tls-openssl = { package = "openssl", version = "0.10", optional = true }
tokio-openssl = { version = "0.6", optional = true } tokio-openssl = { version = "0.6", optional = true }
# TODO: Reduce dependencies where tokio wrappers re-export base crate.
# rustls # rustls
tls-rustls = { package = "rustls", version = "0.19", optional = true }
tokio-rustls = { version = "0.22", optional = true } tokio-rustls = { version = "0.22", optional = true }
webpki = { version = "0.21", optional = true }
webpki-roots = { version = "0.21", optional = true } webpki-roots = { version = "0.21", optional = true }
# native-tls # native-tls
tls-native-tls = { package = "native-tls", version = "0.2", optional = true }
tokio-native-tls = { version = "0.3", optional = true } tokio-native-tls = { version = "0.3", optional = true }
[dev-dependencies] [dev-dependencies]

View File

@ -15,9 +15,9 @@
//! http --verify=false https://127.0.0.1:8443 //! 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 // it is not necessary for your actual code
extern crate tls_rustls as rustls; use tokio_rustls::rustls;
use std::{ use std::{
env, env,

View File

@ -5,7 +5,7 @@ use actix_service::{Service, ServiceFactory};
use actix_utils::counter::Counter; use actix_utils::counter::Counter;
use futures_core::future::LocalBoxFuture; 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}; pub use tokio_native_tls::{TlsAcceptor, TlsStream};
use super::MAX_CONN_COUNTER; use super::MAX_CONN_COUNTER;

View File

@ -12,7 +12,7 @@ use actix_utils::counter::{Counter, CounterGuard};
use futures_core::future::LocalBoxFuture; use futures_core::future::LocalBoxFuture;
use tokio_rustls::{Accept, TlsAcceptor}; use tokio_rustls::{Accept, TlsAcceptor};
pub use rustls::{ServerConfig, Session}; pub use tokio_rustls::rustls::{ServerConfig, Session};
pub use tokio_rustls::server::TlsStream; pub use tokio_rustls::server::TlsStream;
use super::MAX_CONN_COUNTER; use super::MAX_CONN_COUNTER;

View File

@ -6,7 +6,7 @@ use std::{
task::{Context, Poll}, task::{Context, Poll},
}; };
pub use rustls::Session; pub use tokio_rustls::rustls::Session;
pub use tokio_rustls::{client::TlsStream, rustls::ClientConfig}; pub use tokio_rustls::{client::TlsStream, rustls::ClientConfig};
pub use webpki_roots::TLS_SERVER_ROOTS; pub use webpki_roots::TLS_SERVER_ROOTS;
@ -15,7 +15,7 @@ use actix_service::{Service, ServiceFactory};
use futures_core::{future::LocalBoxFuture, ready}; use futures_core::{future::LocalBoxFuture, ready};
use log::trace; use log::trace;
use tokio_rustls::{Connect, TlsConnector}; use tokio_rustls::{Connect, TlsConnector};
use webpki::DNSNameRef; use tokio_rustls::webpki::DNSNameRef;
use crate::connect::{Address, Connection}; use crate::connect::{Address, Connection};

View File

@ -4,12 +4,8 @@
#![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#[cfg(feature = "native-tls")]
extern crate tls_native_tls as native_tls;
#[cfg(feature = "openssl")] #[cfg(feature = "openssl")]
extern crate tls_openssl as openssl; extern crate tls_openssl as openssl;
#[cfg(feature = "rustls")]
extern crate tls_rustls as rustls;
#[cfg(feature = "accept")] #[cfg(feature = "accept")]
pub mod accept; pub mod accept;