pub struct SslConnector<S> { /* private fields */ }Expand description
Opens a transport and upgrades it to client-side TLS using OpenSSL.
Accepts Connect requests with SharedCfg service state. Binding,
readiness, and shutdown are forwarded to the underlying transport connector.
The TlsConfig timeout covers TLS negotiation after transport establishment,
not DNS resolution or TCP connection setup.
The service strips ports and IPv6 brackets before configuring the OpenSSL session’s host. Verification, client identity, and ALPN otherwise follow the supplied OpenSSL connector.
Implementations§
Source§impl<A> SslConnector<Connector<A>>where
A: Address,
impl<A> SslConnector<Connector<A>>where
A: Address,
Sourcepub fn new(openssl: SslConnector) -> SslConnector<Connector<A>>
pub fn new(openssl: SslConnector) -> SslConnector<Connector<A>>
Creates a TLS connector using the default network connector.
Sourcepub fn connector<F, S>(
self,
f: impl IntoService<S, SharedCfg, Connect<A>>,
) -> SslConnector<S>
pub fn connector<F, S>( self, f: impl IntoService<S, SharedCfg, Connect<A>>, ) -> SslConnector<S>
Replaces the default transport connector without changing the TLS policy.
The replacement receives the original request and shared service state. Any filters on its returned I/O remain below TLS.
Source§impl<S> SslConnector<S>
impl<S> SslConnector<S>
Sourcepub async fn connect<F>(
&self,
io: Io<F>,
host: &str,
cfg: &SharedCfg,
) -> Result<Io<Layer<SslFilter, F>>, Error<ConnectError>>where
F: Filter,
pub async fn connect<F>(
&self,
io: Io<F>,
host: &str,
cfg: &SharedCfg,
) -> Result<Io<Layer<SslFilter, F>>, Error<ConnectError>>where
F: Filter,
Completes a client handshake over existing I/O using this connector’s TLS policy.
Does not call the underlying transport service. host is passed directly
to OpenSSL for server-name and verification configuration: supply a DNS
name or IP address without a port or IPv6 brackets. Existing filters are
preserved, and the handshake timeout comes from cfg’s TlsConfig.
§Errors
OpenSSL configuration failures become io::ErrorKind::InvalidInput.
Configuration, handshake, timeout, and transport failures are wrapped as
ConnectError and tagged with the TLS configuration’s service identity.
Trait Implementations§
Source§impl<S> Clone for SslConnector<S>where
S: Clone,
impl<S> Clone for SslConnector<S>where
S: Clone,
Source§fn clone(&self) -> SslConnector<S>
fn clone(&self) -> SslConnector<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<S> Debug for SslConnector<S>where
S: Debug,
impl<S> Debug for SslConnector<S>where
S: Debug,
Source§async fn call(
&self,
req: Connect<A>,
ctx: Ctx<'_, SslConnector<S>, SharedCfg>,
) -> Result<<SslConnector<S> as Service<SharedCfg, Connect<A>>>::Res, <SslConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
async fn call( &self, req: Connect<A>, ctx: Ctx<'_, SslConnector<S>, SharedCfg>, ) -> Result<<SslConnector<S> as Service<SharedCfg, Connect<A>>>::Res, <SslConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
Establishes transport, then upgrades it using the normalized request host.