mirror of
https://github.com/go-gost/x.git
synced 2026-10-19 16:16:32 +00:00
Three fixes found while wiring the p2p hub topology: - The client keepalive was gated on network == "udp", but on a p2p link raddr is the peer's base64 key (no port), so SplitHostPort fails and network is "ip": the keepalive never ran, a tun server never learned the client's route, and the read deadline was never armed. Gate on the udp network OR a configured keepalive period; the udp branch keeps the one-shot registration handshake it always sent. - Liveness was refreshed only by the keepalive echo; a transient channel hiccup can drop that single packet and redial a healthy tunnel after 3xperiod. Refresh the read deadline after any successful read instead. - Routes were never removed: a departed client's IP -> addr stayed forever and the device kept blackholing to a dead address. Expire a route once its last keepalive is older than 3x the configured period, checked lazily on the write path (no sweeper). The TTL is opt-in: without a server-side keepalive/ttl, routes keep their current never-expiring behavior.