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: CancellationTokenImplementations§
Source§impl ProxySession
impl ProxySession
Sourcepub fn new(
session_id: SessionId,
config: ProxySessionConfig,
client_alpn: Vec<u8>,
observer: Arc<dyn ProxyObserver>,
hook: Arc<dyn ProxyHook>,
cancel: CancellationToken,
) -> Self
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).
Sourcepub async fn run(self, client_conn: Connection) -> Result<(), ProxyError>
pub async fn run(self, client_conn: Connection) -> Result<(), ProxyError>
Run the proxy session with a raw QUIC client connection.
Sourcefn initial_draft(&self) -> DraftVersion
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).
Sourcefn draft_is_fixed(&self) -> bool
fn draft_is_fixed(&self) -> bool
Whether the initial draft is fixed (ALPN-derived) or should be refined from CLIENT_SETUP / SERVER_SETUP peek.
Sourceasync fn run_with_transport(self, client: Transport) -> Result<(), ProxyError>
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.
Sourceasync fn connect_upstream(&self) -> Result<Transport, ProxyError>
async fn connect_upstream(&self) -> Result<Transport, ProxyError>
Connect to the upstream relay (with optional timeout).
async fn connect_upstream_inner(&self) -> Result<Transport, ProxyError>
Sourceasync fn connect_upstream_quic(&self) -> Result<Transport, ProxyError>
async fn connect_upstream_quic(&self) -> Result<Transport, ProxyError>
Connect to the upstream relay via QUIC.
Sourcefn build_upstream_tls_config(&self) -> Result<ClientConfig, ProxyError>
fn build_upstream_tls_config(&self) -> Result<ClientConfig, ProxyError>
Build a rustls ClientConfig for the upstream connection.