struct ForwardCtx {
session_id: SessionId,
draft: DraftVersion,
draft_is_fixed: bool,
observer: Arc<dyn ProxyObserver>,
hook: Arc<dyn ProxyHook>,
cancel: CancellationToken,
observer_enabled: bool,
control_mutation: bool,
}Expand description
Shared context for forwarding helpers, avoiding repeated parameter lists.
Fields§
§session_id: SessionId§draft: DraftVersionThe current best draft guess for this session. For control streams
this may be refined after observing CLIENT_SETUP / SERVER_SETUP when
draft_is_fixed is false.
draft_is_fixed: boolWhether draft is fixed (from ALPN) and should not be refined by
peeking at SETUP messages.
observer: Arc<dyn ProxyObserver>§hook: Arc<dyn ProxyHook>§cancel: CancellationToken§observer_enabled: boolCached observer.wants_events() — gates event construction and
emission in the hot forwarding loop. When false, the proxy can
skip parsing for observation purposes and run as a byte pump.
control_mutation: boolCached hook.wants_control_mutation() — when true, the control
stream forwarder switches to a parse-then-forward mode that honors
the hook’s Some(bytes) return. Defaults to false (pure
pass-through) to avoid per-frame parsing latency.
Implementations§
Source§impl ForwardCtx
impl ForwardCtx
Sourcefn emit(&self, event: impl FnOnce() -> ProxyEvent)
fn emit(&self, event: impl FnOnce() -> ProxyEvent)
Emit a proxy event only if the observer wants events.
Takes a closure so the ProxyEvent is not constructed when
observation is disabled — avoiding clones of message payloads in
the hot path.
Trait Implementations§
Source§impl Clone for ForwardCtx
impl Clone for ForwardCtx
Source§fn clone(&self) -> ForwardCtx
fn clone(&self) -> ForwardCtx
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more