Skip to main content

Module transport

Module transport 

Source
Expand description

QUIC transport parameters as a value a caller can write down.

A TransportProfile is a typed, serializable, per-leg description of the QUIC knobs a run wants: congestion controller, windows, loss-detection thresholds, MTU, keep-alive. Eighteen optional fields and nothing else — a field left None is a field this profile has no opinion about, and TransportProfile::apply_to leaves such a field exactly as it found it.

§Beside quinn::TransportConfig, not on top of it

Both legs already accept a raw quinn::TransportConfig, and they still do. A profile is applied over whatever the caller built, rather than replacing it, and the reason that is the only workable shape is a missing trait: quinn::TransportConfig has three impls — the inherent one, Default and Debug — no Clone, and no public getter for any field. A wrapper that owned the configuration could therefore neither copy the caller’s config nor read it back, so it could only ever hand back a fresh default with the caller’s settings discarded. Sitting beside the type and mutating it in place is the one arrangement in which everything this profile does not name is untouched is a fact rather than a claim. See TransportProfile::apply_to for the full statement, including the trap it leaves for a maintainer.

§What is deliberately not a field

There is no enable_segmentation_offload. Segmentation offload is turned off while a socket-level impairment is armed, because GSO hands the kernel one buffer to cut into many datagrams: the socket decorator then sees one send where the wire carries several, and loss, delay and rate accounting all count the wrong unit. A profile able to switch offload back on would let a configuration file undo that from a distance — in a file that says nothing about impairment — and the only symptom would be impairment figures that quietly disagree with what crossed the wire. The knob is absent, so there is nothing to undo it with.

That is the whole of the list, and it has to stay whole to be worth consulting. A quinn knob that is neither a field above nor named here has not been ruled on at all, and a reader who comes here to find out why it is missing takes the silence for a decision — the one thing it cannot be. Carrying the knob and writing a paragraph here are the two ways to leave this section true; there is no third.

§Installing one on a leg

A profile is a value until a connection installs it. Leg names which of the proxy’s two connections is being talked about, and TransportInstaller is the step that turns the profile into the quinn::TransportConfig that leg hands to quinn — DefaultInstaller when the caller supplies none. Both legs refuse to carry a raw quinn::TransportConfig and a profile at once, for the reason spelled out on crate::error::ProxyError::TransportConfigAndProfile: the merge that would appear to combine them cannot exist.

Under the qlog feature a leg carries a third thing, a qlog::QlogSpec saying where its QUIC-level capture goes — plain code font because none of it exists in a build without the feature. A spec composes with a profile, which is applied to the same config the sink is attached to, and it composes with an installer too: TransportInstaller::build hands back an owned quinn::TransportConfig, so the sink is attached to the caller’s own base afterwards and the three settings stack rather than one of them winning silently. A spec is still refused beside a raw config, for a reason of the same shape as the one above: a sink is installed by mutating a quinn::TransportConfig, and a raw config arrives behind an Arc that cannot be mutated. resolve below is where all of it is decided, once per leg and before any endpoint exists.

§Validating

TransportProfile::validate answers before any connection exists, and every rule it enforces is a case where quinn would otherwise accept a value and not honour it. That is the whole reason the type has a validator rather than just a set of setters: a transport parameter that is configured, reported as applied, and silently replaced by something else is indistinguishable from one that worked, and a run built on it is believed.

Re-exports§

pub use crate::types::Leg;

Structs§

AckFrequency
Acknowledgement frequency to request of the peer.
DefaultInstaller
The installer a leg uses when it was given none.
TransportProfile
A per-leg description of QUIC transport parameters.

Enums§

Congestion
The congestion controller to install.
DatagramBuffer
How much room to give incoming QUIC datagrams.
MtuDiscovery
Whether to search for a larger path MTU, and how far.
TransportProfileError
Why a TransportProfile cannot be honoured.

Constants§

QUIC_INITIAL_MTU 🔒
QUIC’s guaranteed-deliverable UDP payload size, in bytes, and the floor that quinn::TransportConfig::initial_mtu and min_mtu silently raise any smaller value to.

Traits§

TransportInstaller
Builds the quinn::TransportConfig a leg installs.

Functions§

idle_timeout 🔒
Convert an idle timeout to the varint of milliseconds quinn stores.
mtu_floor 🔒
Refuse an MTU quinn would silently raise.
resolve 🔒
What a leg installs, from the fields a caller may have set and the installer it may have supplied.
varint 🔒
Convert to a QUIC varint, naming the field if it does not fit.