mirror of
https://github.com/go-gost/x.git
synced 2026-10-19 16:16:32 +00:00
a93975858392dd364fd1a7c52dc3457da7eeaa02
A 20546-byte spoke datagram hit wbuf[:writeOffset+len(p)] (cap 16400) and panicked the whole hub process. Three parts: - tunDevice.Write rejects packets bigger than its buffers with the new exported ErrPacketTooLarge instead of reslicing past the end. The kernel would have refused the write anyway (tun MTU 1420), so nothing deliverable is lost. - Buffers follow the device MTU (max 16KB): newTunDevice(ifce, mtu), so raising tun.mtu for legitimate jumbo UDP automatically makes such packets writable. The relay/KCP/stream path already passes 64KB. - fromSpoke drops an oversized datagram with a windowed count and keeps the peer stream up; only a real device failure still tears the stream down. Tests: tun write guard, normal passthrough, large-MTU accept, and stream survival with rate-limited warnings; all written first and watched fail.
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.
Languages
Go
100%