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: boolMake the underlying UDP socket block when true, otherwise non-blocking.
idle_connection_timeout: DurationMax 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: usizeMax total packet size in bytes (including fragmentation).
max_fragments: u8Max number of fragments per packet (u8).
fragment_size: u16Max size of each fragment.
fragment_reassembly_buffer_size: u16Size of the fragment reassembly buffer.
receive_buffer_max_size: usizeMax receive buffer size in bytes.
rtt_smoothing_factor: f32Smoothing factor (0..1) for RTT measurements.
rtt_max_value: u16Max acceptable RTT in milliseconds before considering a problem.
socket_event_buffer_size: usizeSize of the event buffer for socket events.
socket_polling_timeout: Option<Duration>How long to block when polling socket events.
max_packets_in_flight: u16Max reliable packets in flight before dropping a connection.
max_unestablished_connections: u16Max number of unestablished connections to prevent DoS.
channel_count: u8Number of channels per peer connection (1-255).
incoming_bandwidth_limit: u32Incoming bandwidth limit in bytes/sec (0 = unlimited).
outgoing_bandwidth_limit: u32Outgoing bandwidth limit in bytes/sec (0 = unlimited).
use_checksums: boolEnable CRC32 checksums for data integrity verification (default: false).
compression: CompressionAlgorithmCompression algorithm to use (default: None).
compression_threshold: usizeMinimum packet size to compress in bytes (default: 128). Packets smaller than this won’t be compressed.
use_connection_handshake: boolUse formal 3-way connection handshake for enhanced security (default: false). When enabled, uses Connect->VerifyConnect->ACK handshake with session IDs.
max_waiting_data: usizeMaximum buffered packet data per peer in bytes (0 = unlimited). Prevents memory exhaustion from malicious/buggy clients.
use_advanced_throttling: boolEnable advanced packet throttling with acceleration/deceleration. When enabled, uses dynamic throttle adjustment based on packet loss.
throttle_scale: u32Throttle scale (maximum throttle value, typically 32).
throttle_acceleration: u32Throttle acceleration (rate of improvement when conditions are good).
throttle_deceleration: u32Throttle deceleration (rate of degradation when packet loss occurs).
throttle_interval: u32Interval for throttle updates in milliseconds.
use_window_flow_control: boolEnable dynamic window-based flow control. When enabled, uses adaptive window sizing based on network conditions.
initial_window_size: u32Initial window size for flow control (in packets).
min_window_size: u32Minimum window size (in packets).
max_window_size: u32Maximum window size (in packets).
max_duplicate_peers: u16Maximum 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: boolEnable broadcast mode (default: false). Corresponds to SO_BROADCAST socket option.
use_pmtu_discovery: boolEnable application-level PMTU discovery (default: false). Sends probe commands with increasing sizes and tunes per-peer fragment size.
pmtu_min: u16Minimum PMTU probe size (bytes).
pmtu_max: u16Maximum PMTU probe size (bytes).
pmtu_interval_ms: u32Interval between PMTU probes in milliseconds.
pmtu_converge_threshold: u16Threshold (bytes) at which PMTU search is considered converged.