mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-27 20:12:58 +01:00
cleanup ssl services
This commit is contained in:
parent
a4d4770462
commit
2099629fe3
@ -8,7 +8,6 @@ use tokio_io::{AsyncRead, AsyncWrite};
|
|||||||
|
|
||||||
use crate::counter::{Counter, CounterGuard};
|
use crate::counter::{Counter, CounterGuard};
|
||||||
use crate::ssl::MAX_CONN_COUNTER;
|
use crate::ssl::MAX_CONN_COUNTER;
|
||||||
use crate::ServerConfig;
|
|
||||||
|
|
||||||
/// Support `SSL` connections via native-tls package
|
/// Support `SSL` connections via native-tls package
|
||||||
///
|
///
|
||||||
@ -37,16 +36,14 @@ impl<T: AsyncRead + AsyncWrite> Clone for NativeTlsAcceptor<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: AsyncRead + AsyncWrite> NewService<T, ServerConfig> for NativeTlsAcceptor<T> {
|
impl<T: AsyncRead + AsyncWrite> NewService<T> for NativeTlsAcceptor<T> {
|
||||||
type Response = TlsStream<T>;
|
type Response = TlsStream<T>;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Service = NativeTlsAcceptorService<T>;
|
type Service = NativeTlsAcceptorService<T>;
|
||||||
type InitError = ();
|
type InitError = ();
|
||||||
type Future = FutureResult<Self::Service, Self::InitError>;
|
type Future = FutureResult<Self::Service, Self::InitError>;
|
||||||
|
|
||||||
fn new_service(&self, cfg: &ServerConfig) -> Self::Future {
|
fn new_service(&self, _: &()) -> Self::Future {
|
||||||
cfg.set_secure();
|
|
||||||
|
|
||||||
MAX_CONN_COUNTER.with(|conns| {
|
MAX_CONN_COUNTER.with(|conns| {
|
||||||
ok(NativeTlsAcceptorService {
|
ok(NativeTlsAcceptorService {
|
||||||
acceptor: self.acceptor.clone(),
|
acceptor: self.acceptor.clone(),
|
||||||
|
@ -8,7 +8,6 @@ use tokio_openssl::{AcceptAsync, SslAcceptorExt, SslStream};
|
|||||||
|
|
||||||
use crate::counter::{Counter, CounterGuard};
|
use crate::counter::{Counter, CounterGuard};
|
||||||
use crate::ssl::MAX_CONN_COUNTER;
|
use crate::ssl::MAX_CONN_COUNTER;
|
||||||
use crate::ServerConfig;
|
|
||||||
|
|
||||||
/// Support `SSL` connections via openssl package
|
/// Support `SSL` connections via openssl package
|
||||||
///
|
///
|
||||||
@ -37,16 +36,14 @@ impl<T: AsyncRead + AsyncWrite> Clone for OpensslAcceptor<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: AsyncRead + AsyncWrite> NewService<T, ServerConfig> for OpensslAcceptor<T> {
|
impl<T: AsyncRead + AsyncWrite> NewService<T> for OpensslAcceptor<T> {
|
||||||
type Response = SslStream<T>;
|
type Response = SslStream<T>;
|
||||||
type Error = HandshakeError<T>;
|
type Error = HandshakeError<T>;
|
||||||
type Service = OpensslAcceptorService<T>;
|
type Service = OpensslAcceptorService<T>;
|
||||||
type InitError = ();
|
type InitError = ();
|
||||||
type Future = FutureResult<Self::Service, Self::InitError>;
|
type Future = FutureResult<Self::Service, Self::InitError>;
|
||||||
|
|
||||||
fn new_service(&self, cfg: &ServerConfig) -> Self::Future {
|
fn new_service(&self, _: &()) -> Self::Future {
|
||||||
cfg.set_secure();
|
|
||||||
|
|
||||||
MAX_CONN_COUNTER.with(|conns| {
|
MAX_CONN_COUNTER.with(|conns| {
|
||||||
ok(OpensslAcceptorService {
|
ok(OpensslAcceptorService {
|
||||||
acceptor: self.acceptor.clone(),
|
acceptor: self.acceptor.clone(),
|
||||||
|
@ -10,7 +10,6 @@ use tokio_rustls::{Accept, TlsAcceptor, TlsStream};
|
|||||||
|
|
||||||
use crate::counter::{Counter, CounterGuard};
|
use crate::counter::{Counter, CounterGuard};
|
||||||
use crate::ssl::MAX_CONN_COUNTER;
|
use crate::ssl::MAX_CONN_COUNTER;
|
||||||
use crate::ServerConfig as SrvConfig;
|
|
||||||
|
|
||||||
/// Support `SSL` connections via rustls package
|
/// Support `SSL` connections via rustls package
|
||||||
///
|
///
|
||||||
@ -39,16 +38,14 @@ impl<T> Clone for RustlsAcceptor<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: AsyncRead + AsyncWrite> NewService<T, SrvConfig> for RustlsAcceptor<T> {
|
impl<T: AsyncRead + AsyncWrite> NewService<T> for RustlsAcceptor<T> {
|
||||||
type Response = TlsStream<T, ServerSession>;
|
type Response = TlsStream<T, ServerSession>;
|
||||||
type Error = io::Error;
|
type Error = io::Error;
|
||||||
type Service = RustlsAcceptorService<T>;
|
type Service = RustlsAcceptorService<T>;
|
||||||
type InitError = ();
|
type InitError = ();
|
||||||
type Future = FutureResult<Self::Service, Self::InitError>;
|
type Future = FutureResult<Self::Service, Self::InitError>;
|
||||||
|
|
||||||
fn new_service(&self, cfg: &SrvConfig) -> Self::Future {
|
fn new_service(&self, _: &()) -> Self::Future {
|
||||||
cfg.set_secure();
|
|
||||||
|
|
||||||
MAX_CONN_COUNTER.with(|conns| {
|
MAX_CONN_COUNTER.with(|conns| {
|
||||||
ok(RustlsAcceptorService {
|
ok(RustlsAcceptorService {
|
||||||
acceptor: self.config.clone().into(),
|
acceptor: self.config.clone().into(),
|
||||||
|
Loading…
Reference in New Issue
Block a user