pub struct RustlsConnector(/* private fields */);Expand description
A rustls TLS connector ready to perform TLS handshakes.
Wraps an Arc<ClientConfig> and can be built from a RustlsConnectorConfig via
connector_with_no_client_auth or
connector_with_single_cert, or
directly from a ClientConfig via the From impl.
Implementations§
Source§impl RustlsConnector
impl RustlsConnector
Sourcepub fn new_with_webpki_root_certs() -> Result<Self>
pub fn new_with_webpki_root_certs() -> Result<Self>
Create a new RustlsConnector using the webpki-root certs (requires webpki-root-certs feature enabled)
§Errors
Returns an error if we fail to init our verifier
Sourcepub fn new_with_platform_verifier() -> Result<Self>
pub fn new_with_platform_verifier() -> Result<Self>
Create a new RustlsConnector using the rustls-platform-verifier mechanism (requires platform-verifier feature enabled)
§Errors
Returns an error if we fail to init our verifier
Sourcepub fn new_with_native_certs() -> Result<Self>
pub fn new_with_native_certs() -> Result<Self>
Create a new RustlsConnector using the system certs (requires native-certs feature enabled)
§Errors
Returns an error if we fail to load the native certs.
Sourcepub fn connect<S: Read + Write + Send + 'static>(
&self,
domain: &str,
stream: S,
) -> Result<TlsStream<S>, HandshakeError<S>>
pub fn connect<S: Read + Write + Send + 'static>( &self, domain: &str, stream: S, ) -> Result<TlsStream<S>, HandshakeError<S>>
Connect to the given host
§Errors
Returns a HandshakeError containing either the current state of the handshake or the
failure when we couldn’t complete the handshake
Sourcepub async fn connect_async<S: AsyncRead + AsyncWrite + Send + Unpin + 'static>(
&self,
domain: &str,
stream: S,
) -> Result<AsyncTlsStream<S>>
pub async fn connect_async<S: AsyncRead + AsyncWrite + Send + Unpin + 'static>( &self, domain: &str, stream: S, ) -> Result<AsyncTlsStream<S>>
Trait Implementations§
Source§impl Clone for RustlsConnector
impl Clone for RustlsConnector
Source§fn clone(&self) -> RustlsConnector
fn clone(&self) -> RustlsConnector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more