pub struct InterceptConfig { /* private fields */ }Expand description
Shared state for the intercept feature.
Clone-cheap via Arc — both the proxy handlers and the UI interface
hold a reference to the same instance.
Implementations§
Source§impl InterceptConfig
impl InterceptConfig
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns true if intercept mode is currently enabled.
Sourcepub fn set_enabled(&self, v: bool)
pub fn set_enabled(&self, v: bool)
Enable or disable intercept mode.
When disabling, all currently pending requests are forwarded immediately so clients do not hang.
Sourcepub fn toggle(&self) -> bool
pub fn toggle(&self) -> bool
Toggle intercept on/off. Returns the new state.
When toggling off, all pending requests are forwarded immediately.
Sourcepub fn register(&self, id: u64) -> Receiver<InterceptDecision>
pub fn register(&self, id: u64) -> Receiver<InterceptDecision>
Register a pending intercepted request.
Returns the Receiver that handle_request should await.
The corresponding Sender is stored in the pending map and will
be consumed by resolve.
§Race note
A narrow window exists between is_enabled() returning true in the
handler and register() inserting the sender: if the user toggles
intercept off in that gap, drain_forward() runs before the sender
is in the map and the request will block until the 300 s timeout fires
a 504. This is acceptable — the timeout is the safety net.
Sourcepub fn resolve(&self, id: u64, decision: InterceptDecision) -> bool
pub fn resolve(&self, id: u64, decision: InterceptDecision) -> bool
Resolve a pending request with the given decision.
Returns false if id is not in the pending map (already resolved,
timed out, or unknown).
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Returns the number of requests currently awaiting a UI decision.