pub enum Transport {
Quic(QuicTransport),
}Expand description
A transport-agnostic connection (QUIC or WebTransport).
Variants§
Quic(QuicTransport)
Raw QUIC via quinn.
Implementations§
Source§impl Transport
impl Transport
Sourcepub async fn open_bi(&self) -> Result<(SendStream, RecvStream), TransportError>
pub async fn open_bi(&self) -> Result<(SendStream, RecvStream), TransportError>
Open a bidirectional stream.
Sourcepub async fn accept_bi(
&self,
) -> Result<(SendStream, RecvStream), TransportError>
pub async fn accept_bi( &self, ) -> Result<(SendStream, RecvStream), TransportError>
Accept an incoming bidirectional stream.
Sourcepub async fn open_uni(&self) -> Result<SendStream, TransportError>
pub async fn open_uni(&self) -> Result<SendStream, TransportError>
Open a unidirectional send stream.
Sourcepub async fn accept_uni(&self) -> Result<RecvStream, TransportError>
pub async fn accept_uni(&self) -> Result<RecvStream, TransportError>
Accept an incoming unidirectional stream.
Sourcepub fn send_datagram(&self, data: Bytes) -> Result<(), TransportError>
pub fn send_datagram(&self, data: Bytes) -> Result<(), TransportError>
Send a datagram.
Sourcepub async fn recv_datagram(&self) -> Result<Bytes, TransportError>
pub async fn recv_datagram(&self) -> Result<Bytes, TransportError>
Receive a datagram.
Sourcepub fn closed(
&self,
) -> Option<impl Future<Output = TransportError> + Send + 'static>
pub fn closed( &self, ) -> Option<impl Future<Output = TransportError> + Send + 'static>
A future resolving when the session ends, carrying the peer’s close.
Borrows nothing and outlives this transport, so a caller can take it before handing the transport to a handshake and still be holding it when the peer’s answer lands. That ordering is the whole point: a peer refusing a setup often finishes the control stream first and closes the session a round trip later, by which time the handshake has already returned end-of-stream and dropped everything it had.
None over WebTransport. The session close there is wtransport’s and
its code is in a private field with no accessor — the first of the
README’s known gaps, not a decision made here.
Sourcepub fn peer_certificates(&self) -> Vec<Vec<u8>>
pub fn peer_certificates(&self) -> Vec<Vec<u8>>
The certificate chain the peer presented, DER-encoded, leaf first.
Empty when there is none to report — the handshake has not completed, the peer sent no chain — rather than an error, because none of those are failures of this connection.
This is the whole of the certificate API, and that is deliberate. The bytes are handed over exactly as the peer sent them and nothing here parses them, dates them, or decides whether they are trustworthy. A certificate verdict is a judgement about what the caller is trying to establish: a probe grading a public relay wants to know whether the chain reaches a public root, an operator running against their own CA wants precisely the opposite answer to count as healthy, and a library that picked one would be silently wrong for the other. Whoever knows the question owns the answer; this owns the evidence.
One consequence worth naming, because it is the finding this exists to make visible: the length of what comes back is itself a measurement. A relay that serves a leaf and no intermediate hands back a chain of one, which a client validating against a fixed root set rejects while a browser holding a cached intermediate connects to it happily. That is a misconfiguration and not a mystery — but only to a caller that can see how many certificates arrived, which is why the chain is returned whole rather than as a leaf.
Read off the live connection each time — nothing is cached — so a
caller that intends to keep the chain must take it while it still holds
the Transport. Closing does not by itself erase the answer (quinn
keeps the crypto session for the handle’s lifetime), but dropping the
handle does, and a caller that closes by value has done both.