Skip to main content

Request

Struct Request 

Source
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

Source

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.

Source

pub fn with_publisher(self, publish: impl Consume<Consumer>) -> Self

Publish the given origin to the session.

Source

pub fn with_subscriber(self, subscribe: Producer) -> Self

Subscribe to the given origin from the session.

Source

pub fn with_stats(self, stats: Session) -> Self

Attach a per-connection moq_net::stats::Session context to this session.

Source

pub async fn ok(self) -> Result<Session>

Accept the session, starting the MoQ session loops.

Source

pub fn transport(&self) -> Transport

Returns the network transport carrying this session.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more