pub struct RouteWebsocket {
pub origins: Vec<String>,
pub max_frames_per_sec: Option<u64>,
pub idle_timeout_s: Option<u64>,
pub max_frame_size_bytes: Option<u64>,
}Expand description
Route-scoped WebSocket policy (DW-039, routes[].websocket).
Both knobs are opt-in and independent: an origins list gates the
upgrade handshake (403 before any upstream contact), and
max_frames_per_sec polices the ESTABLISHED tunnel (a client
sending data frames faster than the allowance is closed with a
1008 policy-violation close frame and disconnected). The policing
works on the client-to-upstream direction only — the gateway
protects upstreams from abusive clients, not the reverse (an
abusive upstream is the operator’s backend problem).
Fields§
§origins: Vec<String>Allowed Origin header values for the upgrade handshake
(case-sensitive exact match, e.g. https://app.example.com).
Empty or absent: every origin is allowed (the transparent
default). Non-empty: ONLY listed origins upgrade — a missing
Origin header is DENIED (browsers always send one on
WebSocket handshakes; a request without one is not a browser
and must be named explicitly or fail closed). The literal
string null matches the sandboxed-document origin by exact
match.
max_frames_per_sec: Option<u64>Post-upgrade policing: the sustained allowance of DATA frames
(text, binary, continuation — control frames are free) the
CLIENT may send per second, with a one-second burst of the same
size. A client past its allowance is closed with close code
1008 (policy violation) and disconnected. Absent: no policing
(unlimited, the transparent default). Validation enforces
1..=limits::MAX_WEBSOCKET_FRAMES_PER_SEC.
idle_timeout_s: Option<u64>Post-upgrade idle timeout in seconds (DP-05, #253). If no data flows in either direction for this duration, the tunnel is closed. Absent: no idle timeout (the tunnel stays open until one side closes, the prior default). Validation enforces 1..=86400 (1 second to 24 hours).
max_frame_size_bytes: Option<u64>Maximum payload size of a single WebSocket DATA frame in bytes (DP-05, #253). A frame exceeding this limit causes the connection to be closed with close code 1009 (message too big). Absent: no frame size limit (the prior default). Validation enforces 1..=16777216 (1 byte to 16 MiB).
Trait Implementations§
Source§impl Clone for RouteWebsocket
impl Clone for RouteWebsocket
Source§fn clone(&self) -> RouteWebsocket
fn clone(&self) -> RouteWebsocket
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RouteWebsocket
impl Debug for RouteWebsocket
Source§impl<'de> Deserialize<'de> for RouteWebsocket
impl<'de> Deserialize<'de> for RouteWebsocket
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RouteWebsocket
impl JsonSchema for RouteWebsocket
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for RouteWebsocket
impl PartialEq for RouteWebsocket
Source§impl Serialize for RouteWebsocket
impl Serialize for RouteWebsocket
impl StructuralPartialEq for RouteWebsocket
Auto Trait Implementations§
impl Freeze for RouteWebsocket
impl RefUnwindSafe for RouteWebsocket
impl Send for RouteWebsocket
impl Sync for RouteWebsocket
impl Unpin for RouteWebsocket
impl UnwindSafe for RouteWebsocket
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more