#[non_exhaustive]pub struct IoConfig {
pub max_datagram: usize,
pub timeouts: Timeouts,
pub km_refresh_thresholds: KmRefreshThresholds,
pub cadence: LinkCadence,
pub listener: ListenerLimits,
pub arq: ArqBounds,
pub drift_sample_count: u32,
pub channels: ChannelCapacities,
pub max_bw: MaxBwConfig,
}tokio only.Expand description
Timeouts and sizes for the tokio adapter, carried by SrtSocketConfig into
SrtSocket::connect and SrtListener::bind.
Every value is the caller’s: the library supplies none.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_datagram: usizeLargest datagram accepted from the network (bytes). A
larger datagram is dropped and counted in SocketStats::rx_oversize
(UDP would otherwise truncate it silently). A value outside
MIN_MAX_DATAGRAM..=MAX_MAX_DATAGRAM is refused by
IoConfig::validate, never clamped.
timeouts: TimeoutsThe bounds on every awaited I/O: connect (resolving the remote
address and binding the local socket), handshake (the whole caller
handshake), read_idle (longest silence from a connected peer before the
connection is torn down) and write (longest a single send_to may
take).
km_refresh_thresholds: KmRefreshThresholdscrypto only.KM Refresh thresholds (crypto feature / key rotation); IoConfig::new
starts from the spec-recommended 2^25 / 4000 values.
cadence: LinkCadenceThe link’s protocol cadence (handshake retransmit, Keep-Alive, KM resend, KMREQ floor).
listener: ListenerLimitsThe listener’s handshake and cookie bounds.
arq: ArqBoundsThe ARQ receiver’s and sender’s bounds on every connection.
drift_sample_count: u32Fresh in-sequence packets per drift-sampling window (§4.7, rules 26-27).
The draft gives no number; zero is refused by IoConfig::validate.
channels: ChannelCapacitiesThe capacity of every bounded channel the adapter owns.
max_bw: MaxBwConfigThe LiveCC bandwidth cap each connection paces its DATA packets to.
Implementations§
Source§impl IoConfig
impl IoConfig
Sourcepub fn new(
max_datagram: usize,
timeouts: Timeouts,
cadence: LinkCadence,
listener: ListenerLimits,
arq: ArqBounds,
drift_sample_count: u32,
channels: ChannelCapacities,
max_bw: MaxBwConfig,
) -> Result<Self>
pub fn new( max_datagram: usize, timeouts: Timeouts, cadence: LinkCadence, listener: ListenerLimits, arq: ArqBounds, drift_sample_count: u32, channels: ChannelCapacities, max_bw: MaxBwConfig, ) -> Result<Self>
A config with the caller’s datagram size, timeouts, link cadence
and listener bounds, arq bounds and channel capacities, and the spec-recommended KM
refresh thresholds.
§Errors
Error::InvalidConfig naming the field, for a value IoConfig::validate refuses.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Refuse a value that cannot work: a datagram size outside
MIN_MAX_DATAGRAM..=MAX_MAX_DATAGRAM, a zero listener bound or tick, or an
ARQ bound crate::arq::ArqBounds::validate refuses. Channel capacities cannot be zero
by type. Run by IoConfig::new and again by every connect and bind, so a field set
afterwards is refused too.
§Errors
Error::InvalidConfig naming the field and the rule.
Sourcepub fn with_max_datagram(self, n: usize) -> Self
pub fn with_max_datagram(self, n: usize) -> Self
Set max_datagram; IoConfig::validate refuses an out-of-range
value when the socket is built.
Sourcepub fn with_timeouts(self, timeouts: Timeouts) -> Self
pub fn with_timeouts(self, timeouts: Timeouts) -> Self
Set timeouts.
Sourcepub fn with_km_refresh_thresholds(self, t: KmRefreshThresholds) -> Self
Available on crate feature crypto only.
pub fn with_km_refresh_thresholds(self, t: KmRefreshThresholds) -> Self
crypto only.Set the KM Refresh thresholds (key rotation packet counts).