mirror of
https://github.com/fafhrd91/actix-net
synced 2025-06-28 12:10:37 +02:00
bump MSRV to 1.65 (#485)
This commit is contained in:
@ -56,6 +56,25 @@ pub enum TlsError<TlsErr, SvcErr> {
|
||||
Service(SvcErr),
|
||||
}
|
||||
|
||||
impl<TlsErr> TlsError<TlsErr, Infallible> {
|
||||
/// Casts the infallible service error type returned from acceptors into caller's type.
|
||||
///
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// # use std::convert::Infallible;
|
||||
/// # use actix_tls::accept::TlsError;
|
||||
/// let a: TlsError<u32, Infallible> = TlsError::Tls(42);
|
||||
/// let _b: TlsError<u32, u64> = a.into_service_error();
|
||||
/// ```
|
||||
pub fn into_service_error<SvcErr>(self) -> TlsError<TlsErr, SvcErr> {
|
||||
match self {
|
||||
Self::Timeout => TlsError::Timeout,
|
||||
Self::Tls(err) => TlsError::Tls(err),
|
||||
Self::Service(err) => match err {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<TlsErr, SvcErr> fmt::Display for TlsError<TlsErr, SvcErr> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
@ -80,25 +99,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<TlsErr> TlsError<TlsErr, Infallible> {
|
||||
/// Casts the infallible service error type returned from acceptors into caller's type.
|
||||
///
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// # use std::convert::Infallible;
|
||||
/// # use actix_tls::accept::TlsError;
|
||||
/// let a: TlsError<u32, Infallible> = TlsError::Tls(42);
|
||||
/// let _b: TlsError<u32, u64> = a.into_service_error();
|
||||
/// ```
|
||||
pub fn into_service_error<SvcErr>(self) -> TlsError<TlsErr, SvcErr> {
|
||||
match self {
|
||||
Self::Timeout => TlsError::Timeout,
|
||||
Self::Tls(err) => TlsError::Tls(err),
|
||||
Self::Service(err) => match err {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
@ -23,8 +23,7 @@ use actix_utils::{
|
||||
};
|
||||
use pin_project_lite::pin_project;
|
||||
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
use tokio_rustls::rustls::ServerConfig;
|
||||
use tokio_rustls::{Accept, TlsAcceptor};
|
||||
use tokio_rustls::{rustls::ServerConfig, Accept, TlsAcceptor};
|
||||
|
||||
use super::{TlsError, DEFAULT_TLS_HANDSHAKE_TIMEOUT, MAX_CONN_COUNTER};
|
||||
|
||||
|
@ -33,10 +33,12 @@ pub mod rustls;
|
||||
#[cfg(feature = "native-tls")]
|
||||
pub mod native_tls;
|
||||
|
||||
pub use self::connection::Connection;
|
||||
pub use self::connector::{Connector, ConnectorService};
|
||||
pub use self::error::ConnectError;
|
||||
pub use self::host::Host;
|
||||
pub use self::info::ConnectInfo;
|
||||
pub use self::resolve::Resolve;
|
||||
pub use self::resolver::{Resolver, ResolverService};
|
||||
pub use self::{
|
||||
connection::Connection,
|
||||
connector::{Connector, ConnectorService},
|
||||
error::ConnectError,
|
||||
host::Host,
|
||||
info::ConnectInfo,
|
||||
resolve::Resolve,
|
||||
resolver::{Resolver, ResolverService},
|
||||
};
|
||||
|
@ -19,8 +19,7 @@ use crate::connect::{Connection, Host};
|
||||
pub mod reexports {
|
||||
//! 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;
|
||||
pub use tokio_native_tls::{native_tls::TlsConnector, TlsStream as AsyncTlsStream};
|
||||
}
|
||||
|
||||
/// Connector service and factory using `native-tls`.
|
||||
|
@ -22,9 +22,7 @@ use crate::connect::{Connection, Host};
|
||||
pub mod reexports {
|
||||
//! Re-exports from `openssl` and `tokio-openssl` that are useful for connectors.
|
||||
|
||||
pub use openssl::ssl::{
|
||||
Error, HandshakeError, SslConnector, SslConnectorBuilder, SslMethod,
|
||||
};
|
||||
pub use openssl::ssl::{Error, HandshakeError, SslConnector, SslConnectorBuilder, SslMethod};
|
||||
pub use tokio_openssl::SslStream as AsyncSslStream;
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,11 @@ use actix_rt::net::ActixStream;
|
||||
use actix_service::{Service, ServiceFactory};
|
||||
use actix_utils::future::{ok, Ready};
|
||||
use futures_core::ready;
|
||||
use tokio_rustls::rustls::{client::ServerName, OwnedTrustAnchor, RootCertStore};
|
||||
use tokio_rustls::{client::TlsStream as AsyncTlsStream, rustls::ClientConfig};
|
||||
use tokio_rustls::{Connect as RustlsConnect, TlsConnector as RustlsTlsConnector};
|
||||
use tokio_rustls::{
|
||||
client::TlsStream as AsyncTlsStream,
|
||||
rustls::{client::ServerName, ClientConfig, OwnedTrustAnchor, RootCertStore},
|
||||
Connect as RustlsConnect, TlsConnector as RustlsTlsConnector,
|
||||
};
|
||||
use tracing::trace;
|
||||
use webpki_roots::TLS_SERVER_ROOTS;
|
||||
|
||||
@ -26,8 +28,7 @@ use crate::connect::{Connection, Host};
|
||||
pub mod reexports {
|
||||
//! Re-exports from `rustls` and `webpki_roots` that are useful for connectors.
|
||||
|
||||
pub use tokio_rustls::client::TlsStream as AsyncTlsStream;
|
||||
pub use tokio_rustls::rustls::ClientConfig;
|
||||
pub use tokio_rustls::{client::TlsStream as AsyncTlsStream, rustls::ClientConfig};
|
||||
pub use webpki_roots::TLS_SERVER_ROOTS;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user