pub struct Request<S: Session> { /* private fields */ }Expand description
A paused server-side handshake.
Returned by Server::accept_request once the peer’s advertised
path is known but before the session is granted anything. Set
the origins to serve, then call ok to complete the handshake, or
close to reject it. Modeled on the WebTransport Request in
moq-native.
Implementations§
Source§impl<S: Session> Request<S>
impl<S: Session> Request<S>
Sourcepub fn path(&self) -> &str
pub fn path(&self) -> &str
The request path the client advertised in its SETUP.
Empty when the client advertised none: either it sent an empty path, or the
version carries none in-band (lite 01-04). Those mean the same thing, so the
wire distinction isn’t surfaced. Populated for moq-lite-05 and every
moq-transport draft we speak. See the note on Server::accept_request.
Sourcepub fn role(&self) -> Option<Role>
pub fn role(&self) -> Option<Role>
The single Role the client advertised in its SETUP, or None for a
bidirectional session.
Only moq-lite-05 carries a role, so None covers three cases that the wire
doesn’t distinguish: an older version, a client that omitted the parameter, and a
client that explicitly advertised both directions. All three mean the same thing
(the client may publish and subscribe), so authorize on what the token grants.
See the note on Server::accept_request.
Sourcepub fn peer_origin(&self) -> Option<Origin>
pub fn peer_origin(&self) -> Option<Origin>
The origin identity declared by the peer, when the negotiated protocol carries one.
A moq-lite-05+ endpoint declares this when it attaches a publish or subscribe
origin; a moqt-17+ endpoint declares it via the MoQ Cluster extension. Older
versions and endpoints 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 with_publisher(self, publish: impl Consume<Consumer>) -> Self
pub fn with_publisher(self, publish: impl Consume<Consumer>) -> Self
Sourcepub fn with_subscriber(self, subscribe: Producer) -> Self
pub fn with_subscriber(self, subscribe: Producer) -> Self
Subscribe to the connected client. Overrides any value from the Server builder.
Sourcepub fn with_peer_origin(self, origin: Origin) -> Self
pub fn with_peer_origin(self, origin: Origin) -> Self
Assign the identity this peer’s routes are attributed to, overriding the fresh per-session default.
Only for a peer whose identity the server has actually established, such as one
authenticated by mTLS or a token (crate::Client::with_peer_origin is the
dialing-side equivalent). An identity the peer declares on the wire still wins.
Two sessions given the same origin are treated as one endpoint: routes learned from either are kept off both, and content arriving on either is interchangeable with the other’s. That is the point when they really are one peer reconnecting or running redundant links, and a bug otherwise. Derive it from the authenticated identity, never from something coarser like the remote address.
Sourcepub fn with_stats(self, stats: Session) -> Self
pub fn with_stats(self, stats: Session) -> Self
Set the per-connection stats::Session context. Overrides any value from the
Server builder.