1 //! TLS transport client and listener implementations.
5 //! This module primarily exposes the TLS client implementation over a [`Connection`] type and the
6 //! TLS listener implementation as [`TlsListener`].
9 #[allow(unused_imports)]
10 pub(crate) use crate::Connection;
12 pub(crate) mod client;
13 pub(crate) mod listener;
15 use async_std::net::TcpStream;
16 use async_tls::server;
17 use std::net::SocketAddr;
22 #[cfg(feature = "tls")]
23 // #[doc(cfg(feature = "tls"))]
26 #[cfg(feature = "tls")]
27 // #[doc(cfg(feature = "tls"))]
30 /// Used to differentiate between an outgoing connection ([Client](`TlsConnectionMetadata::Client`))
31 /// or incoming connection listener ([Listener](`TlsConnectionMetadata::Listener`)).
33 /// The async TLS library used by this crate has two differing stream types based on whether the
34 /// connection being established is either a client or server. This is to aid with handling that
35 /// distinction during connection instantiation.
36 pub enum TlsConnectionMetadata {
38 local_addr: SocketAddr,
39 peer_addr: SocketAddr,
40 stream: async_tls::client::TlsStream<TcpStream>,
43 local_addr: SocketAddr,
44 peer_addr: SocketAddr,
45 stream: server::TlsStream<TcpStream>,