Config

Struct Config 

Source
pub struct Config {
Show 41 fields pub blocking_mode: bool, pub idle_connection_timeout: Duration, pub heartbeat_interval: Option<Duration>, pub max_packet_size: usize, pub max_fragments: u8, pub fragment_size: u16, pub fragment_reassembly_buffer_size: u16, pub receive_buffer_max_size: usize, pub rtt_smoothing_factor: f32, pub rtt_max_value: u16, pub socket_event_buffer_size: usize, pub socket_polling_timeout: Option<Duration>, pub max_packets_in_flight: u16, pub max_unestablished_connections: u16, pub channel_count: u8, pub incoming_bandwidth_limit: u32, pub outgoing_bandwidth_limit: u32, pub use_checksums: bool, pub compression: CompressionAlgorithm, pub compression_threshold: usize, pub use_connection_handshake: bool, pub max_waiting_data: usize, pub use_advanced_throttling: bool, pub throttle_scale: u32, pub throttle_acceleration: u32, pub throttle_deceleration: u32, pub throttle_interval: u32, pub use_window_flow_control: bool, pub initial_window_size: u32, pub min_window_size: u32, pub max_window_size: u32, pub max_duplicate_peers: u16, pub socket_recv_buffer_size: Option<usize>, pub socket_send_buffer_size: Option<usize>, pub socket_ttl: Option<u32>, pub socket_broadcast: bool, pub use_pmtu_discovery: bool, pub pmtu_min: u16, pub pmtu_max: u16, pub pmtu_interval_ms: u32, pub pmtu_converge_threshold: u16,
}
Expand description

Configuration options to tune protocol and runtime behavior.

Fields§

§blocking_mode: bool

Make the underlying UDP socket block when true, otherwise non-blocking.

§idle_connection_timeout: Duration

Max idle time before considering a connection disconnected.

§heartbeat_interval: Option<Duration>

Interval for heartbeat packets if no data is sent. None disables heartbeats.

§max_packet_size: usize

Max total packet size in bytes (including fragmentation).

§max_fragments: u8

Max number of fragments per packet (u8).

§fragment_size: u16

Max size of each fragment.

§fragment_reassembly_buffer_size: u16

Size of the fragment reassembly buffer.

§receive_buffer_max_size: usize

Max receive buffer size in bytes.

§rtt_smoothing_factor: f32

Smoothing factor (0..1) for RTT measurements.

§rtt_max_value: u16

Max acceptable RTT in milliseconds before considering a problem.

§socket_event_buffer_size: usize

Size of the event buffer for socket events.

§socket_polling_timeout: Option<Duration>

How long to block when polling socket events.

§max_packets_in_flight: u16

Max reliable packets in flight before dropping a connection.

§max_unestablished_connections: u16

Max number of unestablished connections to prevent DoS.

§channel_count: u8

Number of channels per peer connection (1-255).

§incoming_bandwidth_limit: u32

Incoming bandwidth limit in bytes/sec (0 = unlimited).

§outgoing_bandwidth_limit: u32

Outgoing bandwidth limit in bytes/sec (0 = unlimited).

§use_checksums: bool

Enable CRC32 checksums for data integrity verification (default: false).

§compression: CompressionAlgorithm

Compression algorithm to use (default: None).

§compression_threshold: usize

Minimum packet size to compress in bytes (default: 128). Packets smaller than this won’t be compressed.

§use_connection_handshake: bool

Use formal 3-way connection handshake for enhanced security (default: false). When enabled, uses Connect->VerifyConnect->ACK handshake with session IDs.

§max_waiting_data: usize

Maximum buffered packet data per peer in bytes (0 = unlimited). Prevents memory exhaustion from malicious/buggy clients.

§use_advanced_throttling: bool

Enable advanced packet throttling with acceleration/deceleration. When enabled, uses dynamic throttle adjustment based on packet loss.

§throttle_scale: u32

Throttle scale (maximum throttle value, typically 32).

§throttle_acceleration: u32

Throttle acceleration (rate of improvement when conditions are good).

§throttle_deceleration: u32

Throttle deceleration (rate of degradation when packet loss occurs).

§throttle_interval: u32

Interval for throttle updates in milliseconds.

§use_window_flow_control: bool

Enable dynamic window-based flow control. When enabled, uses adaptive window sizing based on network conditions.

§initial_window_size: u32

Initial window size for flow control (in packets).

§min_window_size: u32

Minimum window size (in packets).

§max_window_size: u32

Maximum window size (in packets).

§max_duplicate_peers: u16

Maximum number of connections allowed from the same IP address (0 = unlimited). Useful for NAT scenarios where multiple clients share the same public IP.

§socket_recv_buffer_size: Option<usize>

Socket receive buffer size in bytes (None = use system default). Corresponds to SO_RCVBUF socket option.

§socket_send_buffer_size: Option<usize>

Socket send buffer size in bytes (None = use system default). Corresponds to SO_SNDBUF socket option.

§socket_ttl: Option<u32>

Time-to-live for outgoing packets (None = use system default). Corresponds to IP_TTL socket option.

§socket_broadcast: bool

Enable broadcast mode (default: false). Corresponds to SO_BROADCAST socket option.

§use_pmtu_discovery: bool

Enable application-level PMTU discovery (default: false). Sends probe commands with increasing sizes and tunes per-peer fragment size.

§pmtu_min: u16

Minimum PMTU probe size (bytes).

§pmtu_max: u16

Maximum PMTU probe size (bytes).

§pmtu_interval_ms: u32

Interval between PMTU probes in milliseconds.

§pmtu_converge_threshold: u16

Threshold (bytes) at which PMTU search is considered converged.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

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

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

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.