Skip to main content

ServerConfig

Struct ServerConfig 

Source
pub struct ServerConfig {
    pub bind: SocketAddr,
    pub data_dir: PathBuf,
    pub authorized_keys_path: PathBuf,
    pub mode: Mode,
    pub issue_admin_token: bool,
    pub admin_bind: Option<SocketAddr>,
    pub admin_session_ttl: Duration,
    pub peer_list_path: PathBuf,
    pub tcp_fallback_bind: Option<SocketAddr>,
    pub bw_partitions: usize,
    pub resume_grace: Option<Duration>,
}
Expand description

Everything the server needs at startup.

Fields§

§bind: SocketAddr

UDP address to bind the QUIC endpoint on.

§data_dir: PathBuf

Directory used for persistent state (identity cert, admin_token hash).

§authorized_keys_path: PathBuf

Path to the authorized_keys file.

§mode: Mode

Deployment mode.

§issue_admin_token: bool

If true, always print a fresh admin token at startup.

§admin_bind: Option<SocketAddr>

§16.4: TCP bind for the structured admin API. None disables the endpoint. Default is loopback-only (127.0.0.1:9700); operators exposing it publicly are expected to front it with a TLS reverse-proxy.

§admin_session_ttl: Duration

§16.4: TTL of admin API session tokens minted from the enrollment admin_token.

§peer_list_path: PathBuf

§16.3.2: on-disk static peer list. Missing file = empty list (no federated peers). Hot-reloaded on file change.

§tcp_fallback_bind: Option<SocketAddr>

§16.1.4: optional TCP+TLS bind for the krot-tcp/1 fallback transport. None disables the fallback listener; clients with UDP blocked will simply not be able to connect. Default is None — operators opt in.

§bw_partitions: usize

§9.2 per-core rate-limit partitions. Should match the actual worker count (1 for Server::run, cores for Server::run_multicore). Each identity’s bw= cap is divided evenly across this many buckets so cores don’t contend on a single governor bucket. Default 1.

§resume_grace: Option<Duration>

§7.3 session-resume grace period. When a client disconnects abruptly (no ServerBye), its tunnels stay in Dangling state for this long so a reconnecting client can pick up the same public URLs. None = protocol default (30s). Local dev may want a shorter value so Ctrl+C → immediate re-run works.

Implementations§

Source§

impl ServerConfig

Source

pub fn local_in(data_dir: PathBuf) -> Self

A local IpMode config with fresh state in data_dir. Useful for tests.

Source

pub fn with_bind(self, bind: SocketAddr) -> Self

Source

pub fn with_mode(self, mode: Mode) -> Self

Source

pub fn with_issue_admin_token(self, issue: bool) -> Self

Source

pub fn with_tcp_fallback_bind(self, addr: SocketAddr) -> Self

Source

pub fn with_bw_partitions(self, n: usize) -> Self

Trait Implementations§

Source§

impl Clone for ServerConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServerConfig

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
Source§

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

Source§

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

Source§

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

Source§

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
Source§

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

Source§

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

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

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

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