pub struct TransparentProxy { /* private fields */ }Expand description
A transparent MoQT proxy that accepts client connections and forwards traffic to an upstream relay.
Each accepted connection spawns a ProxySession that handles
bidirectional stream forwarding with inline MoQT frame parsing. The
client-facing transport (raw QUIC vs WebTransport) is chosen by the
client via ALPN and dispatched automatically — no configuration
required.
Implementations§
Source§impl TransparentProxy
impl TransparentProxy
Sourcepub fn new(config: ProxyConfig, observer: Arc<dyn ProxyObserver>) -> Self
pub fn new(config: ProxyConfig, observer: Arc<dyn ProxyObserver>) -> Self
Create a new proxy with the given configuration and observer.
Sourcepub fn with_hook(
config: ProxyConfig,
observer: Arc<dyn ProxyObserver>,
hook: Arc<dyn ProxyHook>,
) -> Self
pub fn with_hook( config: ProxyConfig, observer: Arc<dyn ProxyObserver>, hook: Arc<dyn ProxyHook>, ) -> Self
Create a new proxy with a custom hook for frame mutation.
Sourcepub fn cancel_token(&self) -> CancellationToken
pub fn cancel_token(&self) -> CancellationToken
Returns a cancellation token that can be used to trigger shutdown.
Sourcepub fn control(&self) -> ProxyControl
pub fn control(&self) -> ProxyControl
A handle onto this proxy — the address it bound, and the sessions it is running.
Callable at any point after the proxy is constructed, and meant to be
called before TransparentProxy::run is awaited: run() does
not return until the proxy is finished, so a caller that waited for
it would never get a handle to a proxy that was doing anything. Every
question a handle answers is defined for a proxy that has not bound
yet — see ProxyControl.
Cheap, and cheap to keep: the handle is one Arc onto state the
proxy already holds, and clones of it share that state rather than
copying it.
Sourcepub async fn run(&self) -> Result<(), ProxyError>
pub async fn run(&self) -> Result<(), ProxyError>
Run the proxy accept loop. Blocks until cancelled or a fatal listener error occurs.