Trait tokio_tls::TlsConnectorExt
[−]
[src]
pub trait TlsConnectorExt: Sealed { fn connect_async<S>(&self, domain: &str, stream: S) -> ConnectAsync<S>
where
S: Read + Write; fn danger_connect_async_without_providing_domain_for_certificate_verification_and_server_name_indication<S>(
&self,
stream: S
) -> ConnectAsync<S>
where
S: Read + Write; }
Extension trait for the TlsConnector
type in the native_tls
crate.
Required Methods
fn connect_async<S>(&self, domain: &str, stream: S) -> ConnectAsync<S> where
S: Read + Write,
S: Read + Write,
Connects the provided stream with this connector, assuming the provided domain.
This function will internally call TlsConnector::connect
to connect
the stream and returns a future representing the resolution of the
connection operation. The returned future will resolve to either
TlsStream<S>
or Error
depending if it's successful or not.
This is typically used for clients who have already established, for example, a TCP connection to a remote server. That stream is then provided here to perform the client half of a connection to a TLS-powered server.
Compatibility notes
Note that this method currently requires S: Read + Write
but it's
highly recommended to ensure that the object implements the AsyncRead
and AsyncWrite
traits as well, otherwise this function will not work
properly.
fn danger_connect_async_without_providing_domain_for_certificate_verification_and_server_name_indication<S>(
&self,
stream: S
) -> ConnectAsync<S> where
S: Read + Write,
&self,
stream: S
) -> ConnectAsync<S> where
S: Read + Write,
Like connect_async
, but does not validate the server's domain name
against its certificate.
Warning
You should think very carefully before you use this method. If hostname verification is not used, any valid certificate for any site will be trusted for use from any other. This introduces a significant vulnerability to man-in-the-middle attacks.
Compatibility notes
Note that this method currently requires S: Read + Write
but it's
highly recommended to ensure that the object implements the AsyncRead
and AsyncWrite
traits as well, otherwise this function will not work
properly.
Implementations on Foreign Types
impl TlsConnectorExt for TlsConnector
[src]
fn connect_async<S>(&self, domain: &str, stream: S) -> ConnectAsync<S> where
S: Read + Write,
[src]
S: Read + Write,
fn danger_connect_async_without_providing_domain_for_certificate_verification_and_server_name_indication<S>(
&self,
stream: S
) -> ConnectAsync<S> where
S: Read + Write,
[src]
&self,
stream: S
) -> ConnectAsync<S> where
S: Read + Write,