1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-08-22 21:15:06 +02:00

prepare actix-tls release 3.0.0-rc.1 (#423)

This commit is contained in:
Rob Ede
2021-11-30 12:34:46 +00:00
committed by GitHub
parent 5dc2bfcb01
commit 183bcf6ae3
10 changed files with 86 additions and 39 deletions

View File

@@ -10,22 +10,24 @@ use actix_utils::future::{ok, Ready};
use futures_core::future::LocalBoxFuture;
use log::trace;
use tokio_native_tls::{
native_tls::TlsConnector as NativeTlsConnector, TlsConnector as TokioNativeTlsConnector,
TlsStream,
native_tls::TlsConnector as NativeTlsConnector, TlsConnector as AsyncNativeTlsConnector,
TlsStream as AsyncTlsStream,
};
use crate::connect::{Connection, Host};
pub mod reexports {
//! Re-exports from `native-tls` that are useful for connectors.
//! Re-exports from `native-tls` and `tokio-native-tls` that are useful for connectors.
pub use tokio_native_tls::native_tls::TlsConnector;
pub use tokio_native_tls::TlsStream as AsyncTlsStream;
}
/// Connector service and factory using `native-tls`.
#[derive(Clone)]
pub struct TlsConnector {
connector: TokioNativeTlsConnector,
connector: AsyncNativeTlsConnector,
}
impl TlsConnector {
@@ -34,7 +36,7 @@ impl TlsConnector {
/// This type is it's own service factory, so it can be used in that setting, too.
pub fn new(connector: NativeTlsConnector) -> Self {
Self {
connector: TokioNativeTlsConnector::from(connector),
connector: AsyncNativeTlsConnector::from(connector),
}
}
}
@@ -43,7 +45,7 @@ impl<R: Host, IO> ServiceFactory<Connection<R, IO>> for TlsConnector
where
IO: ActixStream + 'static,
{
type Response = Connection<R, TlsStream<IO>>;
type Response = Connection<R, AsyncTlsStream<IO>>;
type Error = io::Error;
type Config = ();
type Service = Self;
@@ -62,7 +64,7 @@ where
R: Host,
IO: ActixStream + 'static,
{
type Response = Connection<R, TlsStream<IO>>;
type Response = Connection<R, AsyncTlsStream<IO>>;
type Error = io::Error;
type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>;