pub struct Connection { /* private fields */ }Expand description
A QUIC connection driven by a crate::Worker, usable as a MoQ transport.
Created by Endpoint (or its
client::connect /
server::accept shorthands), already
established. Clones share the connection; each carries its own parking so
concurrent pending operations don’t trample each other’s wakeups. Dropping
every handle (and every stream) drops the driver’s Rc peers, but the
driver itself keeps the connection alive until it ends; close explicitly
with close (which moq’s
session machine does).
That close only records the code: the driver task is what frames the
CONNECTION_CLOSE and hands it to the socket. Drive the worker until
poll_closed resolves
before stopping it, or the packet is never built and the peer idles out
instead.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn peer_chain(&self) -> Option<Vec<Vec<u8>>>
pub fn peer_chain(&self) -> Option<Vec<Vec<u8>>>
The peer’s certificate chain in DER, leaf first, or None if it
presented none.
A server only sees one when it asked
(ClientAuth), and TLS already
validated it against the configured roots by the time this connection
exists: an invalid chain fails the handshake instead. So a Some here
is an authenticated peer, and the chain is what names it.
Sourcepub fn remote_addr(&self) -> SocketAddr
pub fn remote_addr(&self) -> SocketAddr
The peer’s address as of the handshake; a peer that migrates later keeps its connection but not this value.
Sourcepub fn server_name(&self) -> Option<&str>
pub fn server_name(&self) -> Option<&str>
The SNI the client presented, or None if it sent none. Always None
on a dialed connection.
Trait Implementations§
Source§impl Clone for Connection
impl Clone for Connection
Source§impl Debug for Connection
impl Debug for Connection
Source§impl Session for Connection
impl Session for Connection
Source§type SendStream = SendStream
type SendStream = SendStream
!Send
session can hang !Send streams off it.Source§type RecvStream = RecvStream
type RecvStream = RecvStream
!Send
session can hang !Send streams off it.