x

module
v0.28.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2026 License: MIT

README

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.

Directories

Path Synopsis
Package admission implements access control for incoming connections.
Package admission implements access control for incoming connections.
plugin
Package admission implements gRPC-based admission plugins.
Package admission implements gRPC-based admission plugins.
wrapper
Package wrapper provides net.Listener and net.Conn wrappers that enforce admission control at the network level.
Package wrapper provides net.Listener and net.Conn wrappers that enforce admission control at the network level.
api
Documentation of Web API.
Documentation of Web API.
Package bypass implements address-based routing that decides whether a target address should skip the proxy chain and connect directly.
Package bypass implements address-based routing that decides whether a target address should skip the proxy chain and connect directly.
plugin
Package bypass implements plugin-based Bypass using gRPC and HTTP transports.
Package bypass implements plugin-based Bypass using gRPC and HTTP transports.
Package cache provides in-memory implementations of the core cache.Cache interface.
Package cache provides in-memory implementations of the core cache.Cache interface.
Package chain implements the core routing infrastructure for TNET.
Package chain implements the core routing infrastructure for TNET.
cmd
Package cmd converts CLI command-line arguments (-L services, -F chain nodes) into structured config.Config objects.
Package cmd converts CLI command-line arguments (-L services, -F chain nodes) into structured config.Config objects.
loader
Package loader converts a parsed config.Config into running components by parsing each config section and registering the results into the global registries.
Package loader converts a parsed config.Config into running components by parsing each config section and registering the results into the global registries.
parsing
Package parsing converts user-facing configuration structs into registered runtime components.
Package parsing converts user-facing configuration structs into registered runtime components.
parsing/p2p
Package p2p converts a config.P2PConfig into a p2p.Tunnel.
Package p2p converts a config.P2PConfig into a p2p.Tunnel.
connector
direct
Package direct implements a direct (transparent) connector that establishes connections to destination addresses using the dialer provided via connect options.
Package direct implements a direct (transparent) connector that establishes connections to destination addresses using the dialer provided via connect options.
sni
ss
tcp
Package ctx provides typed context keys and helpers for passing per-request data (session ID, addresses, client ID, hash source) through the handler chain.
Package ctx provides typed context keys and helpers for passing per-request data (session ID, addresses, client ID, hash source) through the handler chain.
dialer
kcp
mws
pht
ssh
tcp
tls
udp
wg
ws
handler
api
dns
file
Package file provides a static file-serving handler for TNET.
Package file provides a static file-serving handler for TNET.
forward/local
Package local implements a low-level forwarding handler for raw TCP and UDP connections.
Package local implements a low-level forwarding handler for raw TCP and UDP connections.
forward/remote
Package remote implements a reverse forwarding handler for connections received from remote TNET nodes.
Package remote implements a reverse forwarding handler for connections received from remote TNET nodes.
http
Package http implements an HTTP/HTTPS proxy handler.
Package http implements an HTTP/HTTPS proxy handler.
http2
Package http2 implements an HTTP/2 proxy handler.
Package http2 implements an HTTP/2 proxy handler.
masque
Package masque implements a MASQUE (Multiplexed Application Substrate over QUIC Encryption) proxy handler for TNET.
Package masque implements a MASQUE (Multiplexed Application Substrate over QUIC Encryption) proxy handler for TNET.
router
Package router implements the "router" handler for the TNET framework.
Package router implements the "router" handler for the TNET framework.
serial
Package serial implements a handler for serial port connections in TNET.
Package serial implements a handler for serial port connections in TNET.
sni
Package sni implements a TLS SNI-based forwarding handler for protocol-aware routing.
Package sni implements a TLS SNI-based forwarding handler for protocol-aware routing.
ss
tap
tun
tunnel
Package tunnel implements a reverse proxy tunnel handler for NAT traversal.
Package tunnel implements a reverse proxy tunnel handler for NAT traversal.
tunnel/entrypoint
Package entrypoint implements a public tunnel entry point that accepts external connections and routes them through the tunnel network to internal services behind NAT/firewall.
Package entrypoint implements a public tunnel entry point that accepts external connections and routes them through the tunnel network to internal services behind NAT/firewall.
hop
Package hop provides a hop (node group) implementation that selects a node from a group of proxy nodes using load-balancing strategies, filters, and bypass rules.
Package hop provides a hop (node group) implementation that selects a node from a group of proxy nodes using load-balancing strategies, filters, and bypass rules.
internal
ctx
Package ctx provides typed context value helpers for passing per-request data (buffer, logger, metadata, recorder objects) through the handler chain.
Package ctx provides typed context value helpers for passing per-request data (buffer, logger, metadata, recorder objects) through the handler chain.
io
Package io provides composite IO types that combine separate readers and writers into standard io.ReadWriter and io.ReadWriteCloser pairs, plus helpers for half-close and read-deadline propagation.
Package io provides composite IO types that combine separate readers and writers into standard io.ReadWriter and io.ReadWriteCloser pairs, plus helpers for half-close and read-deadline propagation.
loader
Package loader provides interfaces and implementations for hot-reloadable data sources used by components such as auth, bypass, hosts, and admission.
Package loader provides interfaces and implementations for hot-reloadable data sources used by components such as auth, bypass, hosts, and admission.
matcher
Package matcher provides pattern matching utilities for IP addresses, CIDR blocks, domains, wildcard patterns, and address:port combinations.
Package matcher provides pattern matching utilities for IP addresses, CIDR blocks, domains, wildcard patterns, and address:port combinations.
net
net/httptunnel
Package httptunnel provides the pieces shared by the HTTP tunnel dialers and connectors: a replayable tunnel body and the redirect policy a tunnel client must use.
Package httptunnel provides the pieces shared by the HTTP tunnel dialers and connectors: a replayable tunnel body and the redirect policy a tunnel client must use.
plugin
Package plugin provides shared utilities for building gRPC and HTTP plugin clients.
Package plugin provides shared utilities for building gRPC and HTTP plugin clients.
probe
Package probe implements liveness probe checkers for node health monitoring.
Package probe implements liveness probe checkers for node health monitoring.
util/ech
Package ech provides a DoH-based fetcher and cache for ECHConfigList (Encrypted Client Hello configuration) bytes.
Package ech provides a DoH-based fetcher and cache for ECHConfigList (Encrypted Client Hello configuration) bytes.
util/ech/echtest
Package echtest provides helpers for exercising ECH support in tests.
Package echtest provides helpers for exercising ECH support in tests.
util/httpcache
Package httpcache provides an HTTP response cache layer over the generic core cache.Cache interface.
Package httpcache provides an HTTP response cache layer over the generic core cache.Cache interface.
util/quictest
Package quictest provides an in-process QUIC peer for tests: a TLS configuration for a self-signed server, and helpers to listen and dial on the loopback interface.
Package quictest provides an in-process QUIC peer for tests: a TLS configuration for a self-signed server, and helpers to listen and dial on the loopback interface.
util/serial
Goserial is a simple go package to allow you to read and write from the serial port as a stream of bytes.
Goserial is a simple go package to allow you to read and write from the serial port as a stream of bytes.
util/ss/none
Package none provides a no-op cipher for Shadowsocks that passes data through without encryption.
Package none provides a no-op cipher for Shadowsocks that passes data through without encryption.
limiter
conn
Package conn implements connection limiters that control the number of concurrent connections per key (global, per-IP, or per-CIDR).
Package conn implements connection limiters that control the number of concurrent connections per key (global, per-IP, or per-CIDR).
conn/wrapper
Package wrapper provides net.Conn and net.Listener wrappers that enforce connection limits.
Package wrapper provides net.Conn and net.Listener wrappers that enforce connection limits.
quota
Package quota implements a persisted, long-term traffic-volume limiter that can be shared across services by name.
Package quota implements a persisted, long-term traffic-volume limiter that can be shared across services by name.
quota/wrapper
Package wrapper adapts a named quota onto a listener and its connections, resolving the quota.Limiter by name from the registry on every call so create/update/delete takes effect live and several services can share one.
Package wrapper adapts a named quota onto a listener and its connections, resolving the quota.Limiter by name from the registry on every call so create/update/delete takes effect live and several services can share one.
rate
Package rate implements a rate limiter with support for global, per-IP, and CIDR-based rate limits with periodic hot-reload from file, Redis, or HTTP sources.
Package rate implements a rate limiter with support for global, per-IP, and CIDR-based rate limits with periodic hot-reload from file, Redis, or HTTP sources.
traffic
Package traffic provides a traffic/bandwidth limiter implementation that supports per-service, per-connection, per-IP, and per-CIDR rate limiting for both ingress (In) and egress (Out) directions.
Package traffic provides a traffic/bandwidth limiter implementation that supports per-service, per-connection, per-IP, and per-CIDR rate limiting for both ingress (In) and egress (Out) directions.
traffic/cache
Package limiter provides a cached traffic limiter that wraps a TrafficLimiter with in-memory caching to reduce calls to the underlying limiter (e.g., plugin-based limiters).
Package limiter provides a cached traffic limiter that wraps a TrafficLimiter with in-memory caching to reduce calls to the underlying limiter (e.g., plugin-based limiters).
traffic/wrapper
Package wrapper provides net.Conn, net.PacketConn, and io.ReadWriter wrappers that apply traffic rate limiting to reads and writes.
Package wrapper provides net.Conn, net.PacketConn, and io.ReadWriter wrappers that apply traffic rate limiting to reads and writes.
listener
dns
kcp
mws
pht
ssh
stdio
Package stdio implements a listener that wraps os.Stdin/os.Stdout as a net.Listener.
Package stdio implements a listener that wraps os.Stdin/os.Stdout as a net.Listener.
tap
tcp
tls
tun
udp
ws
Package metadata provides the default implementation of the core/metadata.Metadata interface using a map[string]any with case-insensitive keys.
Package metadata provides the default implementation of the core/metadata.Metadata interface using a map[string]any with case-insensitive keys.
util
Package util provides typed accessor functions for reading values from a metadata.Metadata store.
Package util provides typed accessor functions for reading values from a metadata.Metadata store.
observer
p2p
Package p2p adapts any dialer to run on top of a tunnel supplied by a p2p plugin.
Package p2p adapts any dialer to run on top of a tunnel supplied by a p2p plugin.
plugin
Package plugin implements p2p.Tunnel over the plugin control protocol (github.com/dolfly/plugin/p2p).
Package plugin implements p2p.Tunnel over the plugin control protocol (github.com/dolfly/plugin/p2p).
streamconn
Package streamconn adapts a gRPC bidirectional Tunnel byte stream (the p2p plugin's data plane) to a net.Conn for the TNET side.
Package streamconn adapts a gRPC bidirectional Tunnel byte stream (the p2p plugin's data plane) to a net.Conn for the TNET side.
Package plugin manages the lifecycle of external plugin subprocesses spawned from plugin configuration.
Package plugin manages the lifecycle of external plugin subprocesses spawned from plugin configuration.
Package resolver implements DNS resolution via configurable nameservers with caching, async lookup, and IPv4/IPv6 preference support.
Package resolver implements DNS resolution via configurable nameservers with caching, async lookup, and IPv4/IPv6 preference support.
rewriter
sd
Package service implements the core service.Service interface, binding a listener.Listener and a handler.Handler into a runnable proxy service that accepts inbound connections and forwards traffic through a proxy chain.
Package service implements the core service.Service interface, binding a listener.Listener and a handler.Handler into a runnable proxy service that accepts inbound connections and forwards traffic through a proxy chain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL