pub const DEFAULT_KEEP_ALIVE_INTERVAL: u64 = 20;Expand description
Default keep-alive interval, in seconds.
Well under the 30s UDP conntrack default on a relay, so the NAT mapping is
refreshed even when the tunnel is idle. Must stay below half the idle timeout,
which Config::validate enforces: at exactly half, a single lost keep-alive
packet is enough to let the connection time out.
That rule is checked against the configured max_idle_timeout rather than the
effective one. Against the 30s Surge advertises (see
DEFAULT_MAX_IDLE_TIMEOUT) 20s is past half, leaving one interval of margin
instead of two. Left as it is deliberately: the keep-alive is an ack-eliciting
server-to-client PING, so a lost one is retransmitted by the PTO timer well
inside 30s, whereas halving the interval would double the radio wakeups it
costs a mobile client.