pub struct MtuNegotiator { /* private fields */ }Expand description
Manages MTU discovery via binary search probing.
The caller is responsible for actually sending probe packets — this struct tracks state and interprets results.
Implementations§
Source§impl MtuNegotiator
impl MtuNegotiator
Sourcepub fn start_discovery(&mut self) -> usize
pub fn start_discovery(&mut self) -> usize
Start MTU discovery. Returns the size of the first probe packet to send.
The caller should send a packet of exactly this size and then call
record_probe() with the result.
Sourcepub fn record_probe(&mut self, size: usize, success: bool) -> Option<usize>
pub fn record_probe(&mut self, size: usize, success: bool) -> Option<usize>
Record the result of a probe.
size — the probe packet size that was sent.
success — true if the probe was acknowledged, false if it was dropped/timed out.
Returns the next probe size to send, or None if discovery is complete.
Sourcepub fn check_probe_timeout(&self) -> Option<usize>
pub fn check_probe_timeout(&self) -> Option<usize>
Check if a pending probe has timed out.
If it has, call record_probe(size, false) to register the failure.
Returns the timed-out probe size if applicable.
Sourcepub fn current_mtu(&self) -> usize
pub fn current_mtu(&self) -> usize
Returns the current best known MTU.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns true if MTU discovery is complete.
Sourcepub fn recommended_fragment_size(&self) -> usize
pub fn recommended_fragment_size(&self) -> usize
Returns the recommended fragment_size for VCLConfig based on
the current MTU, subtracting all protocol headers.
Sourcepub fn set_mtu(&mut self, mtu: usize)
pub fn set_mtu(&mut self, mtu: usize)
Force-set the MTU without probing (e.g. from OS PMTUD or known config).
Sourcepub fn fallback_to_min(&mut self)
pub fn fallback_to_min(&mut self)
Fall back to the minimum safe MTU.
Sourcepub fn total_probes(&self) -> u64
pub fn total_probes(&self) -> u64
Returns total probes sent.
Sourcepub fn successful_probes(&self) -> u64
pub fn successful_probes(&self) -> u64
Returns total successful probes.
Sourcepub fn probe_history(&self) -> &[(usize, bool)]
pub fn probe_history(&self) -> &[(usize, bool)]
Returns the full probe history as (size, success) pairs.