pub struct ClientTls {
config: Arc<ClientConfig>,
server_name: ServerName<'static>,
}Expand description
A configured TLS dialer side, plus the name checked in the peer’s certificate.
Fields§
§config: Arc<ClientConfig>§server_name: ServerName<'static>Implementations§
Source§impl ClientTls
impl ClientTls
Sourcepub async fn connect<S>(&self, stream: S) -> Result<MaybeTlsStream<S>>where
S: AsyncRead + AsyncWrite + Unpin,
pub async fn connect<S>(&self, stream: S) -> Result<MaybeTlsStream<S>>where
S: AsyncRead + AsyncWrite + Unpin,
Runs the TLS handshake on a connected socket.
§Errors
Returns an error if the handshake fails, including when the peer’s certificate does not verify against the configured trust anchors or does not match the configured server name.
Sourcepub fn config(&self) -> Arc<ClientConfig>
pub fn config(&self) -> Arc<ClientConfig>
The underlying rustls client config, for a caller that wants to run
its own TLS handshake instead of going through Self::connect —
for example a test client built on another WebSocket/TLS library
that takes a rustls::ClientConfig of its own.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClientTls
impl !RefUnwindSafe for ClientTls
impl Send for ClientTls
impl Sync for ClientTls
impl Unpin for ClientTls
impl !UnwindSafe for ClientTls
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more