Skip to main content

ProxySession

Struct ProxySession 

Source
pub struct ProxySession {
    session_id: SessionId,
    config: ProxySessionConfig,
    client_alpn: Vec<u8>,
    observer: Arc<dyn ProxyObserver>,
    hook: Arc<dyn ProxyHook>,
    cancel: CancellationToken,
}
Expand description

A proxy session that forwards traffic between a client and an upstream relay. One session is created per accepted client connection.

Fields§

§session_id: SessionId§config: ProxySessionConfig§client_alpn: Vec<u8>

The ALPN the client negotiated with us (empty for WebTransport or when unavailable). Drives both upstream ALPN selection and initial draft detection for drafts 15+.

§observer: Arc<dyn ProxyObserver>§hook: Arc<dyn ProxyHook>§cancel: CancellationToken

Implementations§

Source§

impl ProxySession

Source

pub fn new( session_id: SessionId, config: ProxySessionConfig, client_alpn: Vec<u8>, observer: Arc<dyn ProxyObserver>, hook: Arc<dyn ProxyHook>, cancel: CancellationToken, ) -> Self

Create a new proxy session.

client_alpn should be the ALPN the listener negotiated with the client. Pass an empty slice if unavailable (e.g., WebTransport).

Source

pub async fn run(self, client_conn: Connection) -> Result<(), ProxyError>

Run the proxy session with a raw QUIC client connection.

Source

fn initial_draft(&self) -> DraftVersion

The initial draft hint for this session. Drafts 15+ resolve unambiguously from the client ALPN (moqt-15 / moqt-16 / moqt-17); otherwise we fall back to config.draft, which the control-stream parser may refine once it peeks at CLIENT_SETUP / SERVER_SETUP for the moq-00 cohort (drafts 07–14).

Source

fn draft_is_fixed(&self) -> bool

Whether the initial draft is fixed (ALPN-derived) or should be refined from CLIENT_SETUP / SERVER_SETUP peek.

Source

async fn run_with_transport(self, client: Transport) -> Result<(), ProxyError>

Run the proxy session with an already-wrapped transport.

Connects to the upstream relay, then forwards all streams and datagrams bidirectionally between the client and relay. Parses MoQT frames inline and emits events via the observer.

Source

async fn connect_upstream(&self) -> Result<Transport, ProxyError>

Connect to the upstream relay (with optional timeout).

Source

async fn connect_upstream_inner(&self) -> Result<Transport, ProxyError>

Source

async fn connect_upstream_quic(&self) -> Result<Transport, ProxyError>

Connect to the upstream relay via QUIC.

Source

fn build_upstream_tls_config(&self) -> Result<ClientConfig, ProxyError>

Build a rustls ClientConfig for the upstream connection.

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<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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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, 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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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