pub trait ByteStream:
AsyncRead
+ AsyncWrite
+ Send
+ Sync
+ Unpin {
// Required methods
fn peer_endpoint(&self) -> Option<Endpoint>;
fn local_endpoint(&self) -> Option<Endpoint>;
// Provided method
fn peer_certificates(&self) -> Option<Vec<CertificateDer<'static>>> { ... }
}Expand description
Byte-oriented bidirectional stream.
Implemented by TCP, TLS, Unix, and QUIC streams. Extends
AsyncRead + AsyncWrite for compatibility with IO libraries.
Use framed() to convert into a FramedConn with a codec.
Required Methods§
Sourcefn peer_endpoint(&self) -> Option<Endpoint>
fn peer_endpoint(&self) -> Option<Endpoint>
Remote peer address, if available.
Sourcefn local_endpoint(&self) -> Option<Endpoint>
fn local_endpoint(&self) -> Option<Endpoint>
Local address, if available.
Provided Methods§
Sourcefn peer_certificates(&self) -> Option<Vec<CertificateDer<'static>>>
fn peer_certificates(&self) -> Option<Vec<CertificateDer<'static>>>
Peer certificate chain when the underlying transport authenticates
the peer with X.509 (TLS, QUIC). Returns None for plain
TCP/Unix and other unauthenticated transports.
Trait Implementations§
Source§impl ClientLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for Socks5Layer
impl ClientLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for Socks5Layer
async fn handshake( &self, stream: Box<dyn ByteStream>, ) -> Result<Box<dyn ByteStream>>
Source§impl ClientLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for TlsLayer
impl ClientLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for TlsLayer
async fn handshake( &self, stream: Box<dyn ByteStream>, ) -> Result<Box<dyn ByteStream>>
Source§impl<C> ClientLayer<Box<dyn ByteStream>, WsConn<C>> for WsLayer<C>
impl<C> ClientLayer<Box<dyn ByteStream>, WsConn<C>> for WsLayer<C>
Source§impl ServerLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for TlsLayer
impl ServerLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for TlsLayer
async fn handshake( &self, stream: Box<dyn ByteStream>, ) -> Result<Box<dyn ByteStream>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".