Expand description
§VCL MTU Negotiation
Automatic MTU (Maximum Transmission Unit) discovery and negotiation for VCL connections.
§Why MTU matters for VPN
Physical MTU: 1500 bytes (Ethernet)
IP header: 20 bytes
UDP header: 8 bytes
VCL header: ~64 bytes
─────────────────────────
Usable payload: 1408 bytes ← this is what fragment_size should beIf packets are larger than the path MTU they get fragmented by the OS or silently dropped — causing mysterious slowdowns in VPN tunnels.
§Example
use vcl_protocol::mtu::{MtuConfig, MtuNegotiator, PathMtu};
let config = MtuConfig::default();
let mut negotiator = MtuNegotiator::new(config);
// Probe results come in as you send test packets
negotiator.record_probe(1400, true);
negotiator.record_probe(1450, false); // dropped — too large
let mtu = negotiator.current_mtu();
println!("Path MTU: {}", mtu);
let vcl_payload = negotiator.recommended_fragment_size();
println!("Use fragment_size: {}", vcl_payload);Structs§
- MtuConfig
- Configuration for MTU negotiation.
- MtuNegotiator
- Manages MTU discovery via binary search probing.
- PathMtu
- The result of MTU discovery for a network path.
Enums§
- MtuState
- State of the MTU negotiation process.
Constants§
- ETHERNET_
MTU - Standard Ethernet MTU.
- IPV4_
HEADER - IPv4 header size (minimum, no options).
- IPV6_
HEADER - IPv6 header size (fixed).
- MAX_MTU
- Maximum MTU we will ever probe.
- MIN_MTU
- Minimum safe MTU — guaranteed to work everywhere (RFC 791).
- UDP_
HEADER - UDP header size.
- VCL_
HEADER_ OVERHEAD - Overhead added by VCL Protocol headers on top of IP+UDP. Ed25519 sig(64) + prev_hash(32) + nonce(24) + sequence(8) + version(1) + bincode overhead(~20)
Functions§
- fragment_
size_ for_ mtu - Compute the recommended fragment size for a known MTU and transport.