Skip to main content

ServerConfig

Struct ServerConfig 

Source
pub struct ServerConfig {
Show 14 fields pub protocol: u32, pub max_connections: usize, pub max_per_ip: usize, pub max_payload: usize, pub max_stream_payload: usize, pub timeout_ms: u32, pub keepalive_ms: u32, pub packets_per_s: u32, pub bytes_per_s: u32, pub challenges_per_s: u32, pub handshake_ms: u32, pub max_message: usize, pub max_reliable_queued: usize, pub reliable_bytes_per_s: u32,
}
Expand description

a server’s limits and timing

Fields§

§protocol: u32

the app’s protocol id: clients with another one are refused (another game, another version)

§max_connections: usize

connections at once (UDP and WebSocket together)

§max_per_ip: usize

connections from one IP address

§max_payload: usize

the largest payload of a UDP message, both ways (at most MAX_UDP_PAYLOAD)

§max_stream_payload: usize

the largest payload of a message over a WebSocket, both ways

§timeout_ms: u32

nothing received for this long ends a connection

§keepalive_ms: u32

an empty DATA packet after this long without sending (carries the acks)

§packets_per_s: u32

packets a second from one client (UDP: more are dropped; WebSocket: it is disconnected)

§bytes_per_s: u32

bytes a second from one client (as packets_per_s)

§challenges_per_s: u32

handshakes a second whose keys the server works out (two or three X25519 each), for all addresses together; one address prefix (IPv4 /24, IPv6 /48) gets a sixteenth of it. Counted after the cookie checked, so a forged sender costs nothing of it; CONNECTs are answered without it (a HMAC, and less goes back than came: a flood of them throttled new players)

§handshake_ms: u32

a WebSocket must send its CONNECT within this long

§max_message: usize

the largest message of the reliable channel, both ways (a client’s larger one ends its connection)

§max_reliable_queued: usize

bytes of reliable messages queued for one client before send_reliable says Backlog

§reliable_bytes_per_s: u32

bytes a second of reliable chunks to one client (below what its bytes_per_s takes)

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 Copy for ServerConfig

Source§

impl Debug for ServerConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ServerConfig

Source§

fn default() -> Self

Returns the “default value” for a type. 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<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<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, 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> 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.