#[non_exhaustive]pub struct NetOptions {
pub compression: Compression,
pub inactivity_timeout: Duration,
pub total_timeout: Option<Duration>,
pub retry_policy: RetryPolicy,
pub is_insecure: bool,
pub pool_max_idle_per_host: usize,
}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.compression: CompressionAccept-Encoding algorithms the client offers and auto-decodes.
Defaults to all four (gzip | deflate | brotli | zstd); narrow it
when an upstream rejects the full set (anti-bot WAFs that
fingerprint on the exact Accept-Encoding string are a common
reason).
inactivity_timeout: DurationMaximum allowed inactivity between consecutive read operations.
Maps to reqwest::ClientBuilder::read_timeout (documented as
“The timeout applies to each read operation, and resets after a
successful read”) and also drives the Downloader-layer
BodyStream chunk-inactivity guard for the same semantics one
layer down.
Protects against zombie connections that send headers but then stop streaming bytes. Does not cap the total request lifetime; a legitimately slow stream that keeps delivering chunks (even one byte every few seconds) is not aborted. Default 30s is sized to absorb realistic mobile-network stalls (TCP retransmits, captive-portal warm-up, server-side TTFB spikes) without aborting valid slow streams — the player’s contract is “wait for the segment, regardless of connection speed”, and a 10s cap raced real fixtures.
total_timeout: Option<Duration>Hard cap on total request lifetime. Maps to
reqwest::RequestBuilder::timeout. None lets streaming
downloads run indefinitely as long as inactivity_timeout is
satisfied — required for the player to honour “wait for the
segment, regardless of connection speed”. Default Some(2 min)
keeps a safety net against pathological cases (server stuck in
mid-body without ever closing) while not racing realistic
slow-network seeks.
retry_policy: RetryPolicy§is_insecure: boolAccept invalid TLS certificates (self-signed, expired, wrong hostname). Security risk — use only for local development and test servers.
pool_max_idle_per_host: usizeMax idle connections per host. Enables HTTP keep-alive connection
reuse, reducing TIME_WAIT accumulation under high request volume.
Set to 0 to disable pooling.
Implementations§
Source§impl NetOptions
impl NetOptions
Sourcepub fn builder() -> NetOptionsBuilder
pub fn builder() -> NetOptionsBuilder
Create an instance of NetOptions using the builder syntax
Trait Implementations§
Source§impl Clone for NetOptions
impl Clone for NetOptions
Source§fn clone(&self) -> NetOptions
fn clone(&self) -> NetOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more