pub struct VCLConfig {
pub transport: TransportMode,
pub reliability: ReliabilityMode,
pub max_retries: u32,
pub retry_interval_ms: u64,
pub fragment_size: usize,
pub flow_window_size: usize,
}Expand description
Full configuration for a VCL connection.
Controls transport, reliability, fragmentation, and flow control behaviour. Use one of the preset constructors or build a custom config.
§Presets
| Preset | Transport | Reliability | Use case |
|---|---|---|---|
vpn() | TCP | Reliable | VPN tunnels, secure comms |
gaming() | UDP | Partial | Real-time games |
streaming() | UDP | Unreliable | Video/audio streaming |
auto() | Auto | Adaptive | Unknown / mixed traffic |
Fields§
§transport: TransportModeTransport protocol to use.
reliability: ReliabilityModeReliability guarantee for packet delivery.
max_retries: u32Maximum number of retransmission attempts for lost packets.
Only used when reliability is Reliable or Partial.
Default: 5
retry_interval_ms: u64Time in milliseconds between retransmission attempts.
Default: 100
fragment_size: usizeMaximum payload size per fragment in bytes.
Packets larger than this are split into multiple fragments.
Default: 1200 (safe for most networks including VPN overhead)
flow_window_size: usizeNumber of packets that can be in-flight simultaneously (flow control window).
Default: 64
Implementations§
Source§impl VCLConfig
impl VCLConfig
Sourcepub fn vpn() -> Self
pub fn vpn() -> Self
VPN mode — reliability over speed.
Uses TCP with guaranteed delivery. Every packet is retransmitted on loss. Suitable for VPN tunnels, secure communications, financial transactions.
use vcl_protocol::config::{VCLConfig, TransportMode, ReliabilityMode};
let config = VCLConfig::vpn();
assert_eq!(config.transport, TransportMode::Tcp);
assert_eq!(config.reliability, ReliabilityMode::Reliable);Sourcepub fn gaming() -> Self
pub fn gaming() -> Self
Gaming mode — speed over reliability.
Uses UDP with partial reliability. Only critical packets are retransmitted. Suitable for real-time games, position updates, input events.
use vcl_protocol::config::{VCLConfig, TransportMode, ReliabilityMode};
let config = VCLConfig::gaming();
assert_eq!(config.transport, TransportMode::Udp);
assert_eq!(config.reliability, ReliabilityMode::Partial);Sourcepub fn streaming() -> Self
pub fn streaming() -> Self
Streaming mode — lowest latency, no retransmission.
Uses UDP with no reliability guarantees. Lost packets are dropped silently. Suitable for video/audio streaming where a missed frame is better than lag.
use vcl_protocol::config::{VCLConfig, TransportMode, ReliabilityMode};
let config = VCLConfig::streaming();
assert_eq!(config.transport, TransportMode::Udp);
assert_eq!(config.reliability, ReliabilityMode::Unreliable);Sourcepub fn auto() -> Self
pub fn auto() -> Self
Auto mode — recommended default.
VCL selects transport and reliability dynamically based on network conditions. Starts with UDP, upgrades to TCP on detected packet loss.
use vcl_protocol::config::{VCLConfig, TransportMode, ReliabilityMode};
let config = VCLConfig::auto();
assert_eq!(config.transport, TransportMode::Auto);
assert_eq!(config.reliability, ReliabilityMode::Adaptive);Sourcepub fn is_tcp(&self) -> bool
pub fn is_tcp(&self) -> bool
Returns true if this config uses TCP transport or will select TCP in Auto mode.
Sourcepub fn has_retransmission(&self) -> bool
pub fn has_retransmission(&self) -> bool
Returns true if retransmission is enabled for this config.
Sourcepub fn needs_fragmentation(&self, size: usize) -> bool
pub fn needs_fragmentation(&self, size: usize) -> bool
Returns true if fragmentation is needed for a payload of size bytes.