ginuerzh f1cd7c945a tun: the registration handshake is not a keepalive option
A tun client registers its device's addresses with the far side's tun
server by sending the handshake frame. That frame is what tells the server
which addresses this device holds, and it is the only thing that can: a
server routes by destination address, so without it the link is one-way —
traffic leaves and nothing comes back.

keepalive() has always sent it unconditionally and returned early when no
period was configured, so the period only ever decided whether it
repeated. The call site did not: it was gated on the udp network or a
configured period, which on a p2p link ("ip") meant no period, no
handshake, no registration at all. That is the shape a p2p hub needs
least — its route table has no TTL to refresh, so the repeat buys nothing
there and the one-shot is the whole of it.

The gate is gone; the handshake always runs. The period keeps its meaning
where it has one: a server reached over UDP is connectionless, so silence
is the only signal that a peer has left, and the repeat is what lets its
route expire.

Found by a user asking why the keepalive switch was needed at all. It was
not, on a p2p hub — and turning it off silently produced the one-way link
the entrypoint's own comment warns about.
2026-10-03 22:45:29 +08:00
2026-07-29 22:39:19 +08:00
2022-03-14 20:27:50 +08:00

x

The implementation layer for the GOST proxy framework. Every interface defined in core/ is implemented here — handlers, listeners, dialers, connectors, plus config parsing, registries, and all cross-cutting concerns.

Package layout

Directory Purpose
handler/ Protocol handlers (http, socks4/5, ss, ssh, tunnel, tun, dns, redirect, etc.)
listener/ Protocol listeners (tcp, tls, ws, http2/3, quic, kcp, icmp, tun, udp, etc.)
dialer/ Outbound dialers (tcp, tls, ws, http2/3, quic, grpc, ssh, wg, kcp, icmp, etc.)
connector/ Destination connectors (http, socks4/5, ss, ssh, relay, tunnel, direct, etc.)
config/ Config struct, YAML/JSON parsing, and service construction
registry/ Typed global registries for all component types
service/ Accept loop wiring listener + handler
chain/ Multi-hop forwarding chain and route implementation
router/ Route table router (destination-based routing)
hop/ Node group with load-balanced selection
selector/ Load-balancing strategies (round-robin, random, weighted, hash)
auth/, bypass/, admission/ Authentication, bypass rules, admission control
resolver/, hosts/ DNS resolution and host mapping
limiter/ Traffic, connection, and rate limiters
recorder/, observer/ Traffic recording and observability
ingress/, sd/, routing/ Ingress control, service discovery, routing rules
logger/, metrics/, api/ Logging, Prometheus metrics, Web API
metadata/, ctx/ Metadata key-value system and context propagation
internal/ Shared internals — not importable externally

Component pattern

Every handler, listener, dialer, and connector follows the same pattern: init() registers a constructor into a global registry, the constructor takes functional options, and Init(metadata.Metadata) extracts typed configuration from the metadata key-value map.

See CLAUDE.md for detailed architecture and conventions.

S
Description
Extended (may be experimental) features outside the main gost tree.
Readme MIT
5.3 MiB
Languages
Go 100%