pub struct OriginAllowlist { /* private fields */ }Expand description
A per-connecting-origin outbound allowlist for the bridge.
Maps each connecting tab origin (the Origin presented at the WebSocket
upgrade) to the set of outbound origins a request routed to that tab may
reach. This is the mechanism behind per-origin scoping: a Grafana tab and a
Facebook tab each carry only their own grant, so neither can borrow the
other’s outbound scope.
Built from repeatable --allow-origin values, each either a bare ORIGIN
(shorthand: the tab may reach its own origin) or an explicit
CONNECT=OUTBOUND mapping; repeats accumulate outbound origins under the same
connecting key. An empty allowlist is the unconfigured default — the WS gate
admits any origin (the session token is the gate) and outbound scope is
default-closed (relative URLs only).
Implementations§
Source§impl OriginAllowlist
impl OriginAllowlist
Sourcepub fn parse<S: AsRef<str>>(values: &[S]) -> Result<Self, String>
pub fn parse<S: AsRef<str>>(values: &[S]) -> Result<Self, String>
Parses repeatable --allow-origin CLI values into an allowlist.
Each value is ORIGIN (shorthand for ORIGIN=ORIGIN) or
CONNECT=OUTBOUND. Both sides must be valid, non-opaque origins; a
malformed or empty side is a hard error naming the offending value.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether no --allow-origin was configured (the default-open WS gate,
default-closed outbound case).
Sourcepub fn permits_connection(&self, origin: Option<&str>) -> bool
pub fn permits_connection(&self, origin: Option<&str>) -> bool
Whether a WebSocket upgrade from origin is permitted.
An empty allowlist admits any origin (the token in the subprotocol is the gate). Otherwise the connecting origin must be a configured key — an origin-less upgrade is rejected once any entry exists.
Sourcepub fn outbound_for(&self, origin: Option<&str>) -> Vec<&str>
pub fn outbound_for(&self, origin: Option<&str>) -> Vec<&str>
The outbound origins granted to a request routed to a tab on origin.
Empty when the tab’s origin is unknown or carries no grant — leaving only
relative URLs permitted (see validate_outbound_url).
Trait Implementations§
Source§impl Clone for OriginAllowlist
impl Clone for OriginAllowlist
Source§fn clone(&self) -> OriginAllowlist
fn clone(&self) -> OriginAllowlist
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OriginAllowlist
impl Debug for OriginAllowlist
Source§impl Default for OriginAllowlist
impl Default for OriginAllowlist
Source§fn default() -> OriginAllowlist
fn default() -> OriginAllowlist
impl Eq for OriginAllowlist
Source§impl PartialEq for OriginAllowlist
impl PartialEq for OriginAllowlist
Source§fn eq(&self, other: &OriginAllowlist) -> bool
fn eq(&self, other: &OriginAllowlist) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for OriginAllowlist
Auto Trait Implementations§
impl Freeze for OriginAllowlist
impl RefUnwindSafe for OriginAllowlist
impl Send for OriginAllowlist
impl Sync for OriginAllowlist
impl Unpin for OriginAllowlist
impl UnsafeUnpin for OriginAllowlist
impl UnwindSafe for OriginAllowlist
Blanket Implementations§
Source§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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.