pub struct GatewayConfig { /* private fields */ }Expand description
Limits and trusted origin for one gateway instance.
The Station token is deliberately omitted from Debug; callers should load it
from their scoped credential source and never log it.
Implementations§
Source§impl GatewayConfig
impl GatewayConfig
Sourcepub fn new(
public_origin: impl Into<String>,
station_token: impl Into<String>,
limits: GatewayLimits,
attach_token_ttl: Duration,
write_lease_ttl: Duration,
) -> Result<Self, GatewayError>
pub fn new( public_origin: impl Into<String>, station_token: impl Into<String>, limits: GatewayLimits, attach_token_ttl: Duration, write_lease_ttl: Duration, ) -> Result<Self, GatewayError>
Creates a gateway config and rejects limits that cannot work together: a zero where
nothing could pass, and Runs, connections and frames that could hold more than
buffer_budget_bytes or client_slots allow.
Sourcepub fn with_unex_limits(self, limits: UnexLimits) -> Self
pub fn with_unex_limits(self, limits: UnexLimits) -> Self
Replaces the default [controls], [timeline] and [text] limits (and [login]’s
pace) with the unex record’s; the [gateway] table is limits of GatewayConfig::new.
Sourcepub fn set_unex_limits(&self, limits: UnexLimits)
pub fn set_unex_limits(&self, limits: UnexLimits)
Makes the gateway run by limits from the next request on: the [controls], [timeline],
[search], [attach] and [text] tables, and the [gateway] keys read per request. What
the gateway sized when it started (queues, slots, token lifetimes, [login]) keeps its size.
Sourcepub fn unex(&self) -> Arc<UnexLimits> ⓘ
pub fn unex(&self) -> Arc<UnexLimits> ⓘ
The unex record’s limit tables this gateway runs by now.
Sourcepub fn with_login_limits(self, login: LoginLimits) -> Self
pub fn with_login_limits(self, login: LoginLimits) -> Self
Replaces the default limits on password and key tries at the login route.
Sourcepub fn attach_token_ttl(&self) -> Duration
pub fn attach_token_ttl(&self) -> Duration
How long an attach token lasts.
Sourcepub fn write_lease_ttl(&self) -> Duration
pub fn write_lease_ttl(&self) -> Duration
How long a write lease lasts.
Sourcepub fn set_lifetimes(
&self,
attach_token_ttl: Duration,
write_lease_ttl: Duration,
) -> Result<(), GatewayError>
pub fn set_lifetimes( &self, attach_token_ttl: Duration, write_lease_ttl: Duration, ) -> Result<(), GatewayError>
Makes the attach tokens and write leases issued from now on last the given times; those already issued keep theirs. A zero lifetime is refused and changes nothing.
Sourcepub fn set_secret_limits(
&self,
station_token_min_bytes: usize,
origin_bytes: Limit,
) -> Result<(), GatewayError>
pub fn set_secret_limits( &self, station_token_min_bytes: usize, origin_bytes: Limit, ) -> Result<(), GatewayError>
Holds the public origin and the Station token to station_token_min_bytes and
origin_bytes from now on. Both are fixed while the gateway runs, so a value they no
longer satisfy is refused and the earlier ones stay.
Sourcepub fn secret_limits(&self) -> (usize, Limit)
pub fn secret_limits(&self) -> (usize, Limit)
The station_token_min_bytes and origin_bytes the gateway holds its token and origin to.
Sourcepub fn public_origin(&self) -> &str
pub fn public_origin(&self) -> &str
The origin browser requests must match exactly.