pub struct TlsConnector<S> { /* private fields */ }Expand description
Opens a transport and upgrades it to client-side TLS using rustls.
The service accepts Connect requests with SharedCfg state. It strips
ports and IPv6 brackets from the request host for rustls server-name handling.
The supplied [ClientConfig] determines trust, client identity, and ALPN.
Binding, readiness, and shutdown are forwarded to the underlying connector.
The TlsConfig timeout starts after that connector returns, so it does not
bound DNS resolution or TCP connection establishment. Handshake errors are
returned as ConnectError with the TLS configuration’s service identity.
Implementations§
Source§impl<A> TlsConnector<Connector<A>>where
A: Address,
impl<A> TlsConnector<Connector<A>>where
A: Address,
Sourcepub fn new(config: ClientConfig) -> TlsConnector<Connector<A>>
pub fn new(config: ClientConfig) -> TlsConnector<Connector<A>>
Creates a TLS connector using the default network connector.
Use the From<Arc<ClientConfig>> implementation to share an existing
rustls configuration instead of transferring an owned value.
Sourcepub fn connector<F, S>(
self,
f: impl IntoService<S, SharedCfg, Connect<A>>,
) -> TlsConnector<S>
pub fn connector<F, S>( self, f: impl IntoService<S, SharedCfg, Connect<A>>, ) -> TlsConnector<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.
Trait Implementations§
Source§impl<S> Clone for TlsConnector<S>where
S: Clone,
impl<S> Clone for TlsConnector<S>where
S: Clone,
Source§fn clone(&self) -> TlsConnector<S>
fn clone(&self) -> TlsConnector<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 TlsConnector<S>where
S: Debug,
impl<S> Debug for TlsConnector<S>where
S: Debug,
Source§async fn call(
&self,
req: Connect<A>,
ctx: Ctx<'_, TlsConnector<S>, SharedCfg>,
) -> Result<<TlsConnector<S> as Service<SharedCfg, Connect<A>>>::Res, <TlsConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
async fn call( &self, req: Connect<A>, ctx: Ctx<'_, TlsConnector<S>, SharedCfg>, ) -> Result<<TlsConnector<S> as Service<SharedCfg, Connect<A>>>::Res, <TlsConnector<S> as Service<SharedCfg, Connect<A>>>::Error>
Establishes transport first, then validates the server name and times the TLS handshake.