Skip to main content

GatewayConfig

Struct GatewayConfig 

Source
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

Source

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.

Source

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.

Source

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.

Source

pub fn unex(&self) -> Arc<UnexLimits> ⓘ

The unex record’s limit tables this gateway runs by now.

Source

pub fn with_login_limits(self, login: LoginLimits) -> Self

Replaces the default limits on password and key tries at the login route.

Source

pub fn attach_token_ttl(&self) -> Duration

How long an attach token lasts.

Source

pub fn write_lease_ttl(&self) -> Duration

How long a write lease lasts.

Source

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.

Source

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.

Source

pub fn secret_limits(&self) -> (usize, Limit)

The station_token_min_bytes and origin_bytes the gateway holds its token and origin to.

Source

pub fn public_origin(&self) -> &str

The origin browser requests must match exactly.

Trait Implementations§

Source§

impl Debug for GatewayConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoMaybeUndefined<T> for T

§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
§

impl<T> IntoOption<T> for T

§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more