Skip to main content

IoConfig

Struct IoConfig 

Source
#[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 close: CloseTimings, pub max_bw: MaxBwConfig, }
Available on crate feature 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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§max_datagram: usize

Largest 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: Timeouts

The 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: KmRefreshThresholds

KM Refresh thresholds (key rotation); IoConfig::new starts from the spec-recommended 2^25 / 4000 values. The type carries no crypto dependency; the value is held in every feature configuration.

§cadence: LinkCadence

The link’s protocol cadence (handshake retransmit, Keep-Alive, KM resend, KMREQ floor).

§listener: ListenerLimits

The listener’s handshake and cookie bounds.

§arq: ArqBounds

The ARQ receiver’s and sender’s bounds on every connection.

§drift_sample_count: u32

Fresh in-sequence packets per drift-sampling window (§4.7, rules 26-27). The draft gives no number; zero is refused by IoConfig::validate.

§channels: ChannelCapacities

The capacity of every bounded channel the adapter owns.

§close: CloseTimings

How long a closing sender waits for ACKs of its unacknowledged packets. The caller’s; expiry is reported as damage rather than silently dropping the tail.

§max_bw: MaxBwConfig

The LiveCC bandwidth cap each connection paces its DATA packets to.

Implementations§

Source§

impl IoConfig

Source

pub fn for_profile(profile: Profile) -> Self

The Profile preset: every field stated, the listener, ARQ, cadence and channel bounds from their own presets. Every preset passes Self::validate (pinned by a test); the existing with_* setters and the public fields replace any part.

Source§

impl IoConfig

Source

pub fn new( max_datagram: usize, timeouts: Timeouts, cadence: LinkCadence, listener: ListenerLimits, arq: ArqBounds, drift_sample_count: u32, channels: ChannelCapacities, max_bw: MaxBwConfig, close: CloseTimings, ) -> 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.

Source

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.

Source

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.

Source

pub fn with_timeouts(self, timeouts: Timeouts) -> Self

Set timeouts.

Source

pub fn with_km_refresh_thresholds(self, t: KmRefreshThresholds) -> Self

Set the KM Refresh thresholds (key rotation packet counts).

Trait Implementations§

Source§

impl Clone for IoConfig

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 IoConfig

Source§

impl Debug for IoConfig

Source§

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

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

impl Eq for IoConfig

Source§

impl PartialEq for IoConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for IoConfig

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