pub struct Request { /* private fields */ }Expand description
An incoming MoQ session that can be accepted or rejected.
The transport connection and the MoQ SETUP are already complete, so path,
role, url, and peer_identity are
all populated consistently regardless of transport. Self::with_publisher and
Self::with_subscriber configure what is published and subscribed to on the session;
otherwise the Server’s configuration is used by default. Call Self::ok to start the
session, or Self::close to reject it (which closes the just-established session).
Implementations§
Source§impl Request
impl Request
Sourcepub async fn close(self, code: u16) -> Result<()>
pub async fn close(self, code: u16) -> Result<()>
Reject the session. The transport is already accepted, so this closes the
just-established MoQ session rather than answering the transport handshake:
the code (an HTTP-style status the caller passes) maps to a MoQ close reason.
Sourcepub fn with_publisher(self, publish: impl Consume<Consumer>) -> Self
pub fn with_publisher(self, publish: impl Consume<Consumer>) -> Self
Publish the given origin to the session.
Sourcepub fn with_subscriber(self, subscribe: Producer) -> Self
pub fn with_subscriber(self, subscribe: Producer) -> Self
Subscribe to the given origin from the session.
Sourcepub fn with_stats(self, stats: Session) -> Self
pub fn with_stats(self, stats: Session) -> Self
Attach a per-connection moq_net::stats::Session context to this session.
Sourcepub fn url(&self) -> Option<&Url>
pub fn url(&self) -> Option<&Url>
Returns the URL the client dialed, for transports that carry one (QUIC/WebTransport).
None for the URL-less stream bindings (tcp/unix); use Self::path for their
in-band request path.
Sourcepub fn path(&self) -> &str
pub fn path(&self) -> &str
The request path the client advertised, uniform across transports.
Taken from the SETUP for the URL-less stream bindings (and moq-transport, which
carries it in-band), and from the dial url for WebTransport/QUIC.
Empty only when neither carries one.
Sourcepub fn role(&self) -> Option<Role>
pub fn role(&self) -> Option<Role>
The single direction the client advertised in its SETUP, or None for a
bidirectional session (it omitted the role, or the version carries none).
Available on every transport. Use it to reject a token that lacks the scope for
the client’s intended direction.
Sourcepub fn peer_origin(&self) -> Option<Origin>
pub fn peer_origin(&self) -> Option<Origin>
The origin identity the peer declared in its SETUP (moq-lite-05+).
A peer declares this when it attaches a publish or subscribe origin.
Older versions and peers without one return None.
Self-declared, so treat it as a correlation hint rather than an authenticated identity: authorize on the token or client certificate.
Sourcepub fn peer_identity(&self) -> Option<PeerIdentity>
pub fn peer_identity(&self) -> Option<PeerIdentity>
The client certificate chain the peer presented, if any, validated
against a configured crate::tls::Server::root during the handshake.
Captured at the transport handshake (before the SETUP). Only the Quinn and noq
backends support mTLS; other transports always return None. Use it to grant
elevated access or to close the session once the certificate expires (see
crate::tls::PeerIdentity::expiry).