Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMTUTooSmall = errors.New("MTU must be at least 1280")
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶
type ClientConfig struct { Name string `json:"name"` Endpoint conn.Addr `json:"endpoint"` Protocol string `json:"protocol"` DialerFwmark int `json:"dialerFwmark"` // TCP EnableTCP bool `json:"enableTCP"` DialerTFO bool `json:"dialerTFO"` // UDP EnableUDP bool `json:"enableUDP"` MTU int `json:"mtu"` // Shadowsocks PSK []byte `json:"psk"` IPSKs [][]byte `json:"iPSKs"` PaddingPolicy string `json:"paddingPolicy"` // contains filtered or unexported fields }
ClientConfig stores a client configuration. It may be marshaled as or unmarshaled from JSON.
type Relay ¶
type Relay interface { // String returns the relay service's name. String() string // Start starts the relay service. Start() error // Stop stops the relay service. Stop() error }
Relay is a relay service that accepts incoming connections/sessions on a server and dispatches them to a client selected by the router.
Both TCPRelay and UDPRelay implement this interface.
type ServerConfig ¶
type ServerConfig struct { Name string `json:"name"` Listen string `json:"listen"` Protocol string `json:"protocol"` ListenerFwmark int `json:"listenerFwmark"` // TCP EnableTCP bool `json:"enableTCP"` ListenerTFO bool `json:"listenerTFO"` DisableInitialPayloadWait bool `json:"disableInitialPayloadWait"` // UDP EnableUDP bool `json:"enableUDP"` MTU int `json:"mtu"` // Simple tunnel TunnelRemoteAddress conn.Addr `json:"tunnelRemoteAddress"` TunnelUDPTargetOnly bool `json:"tunnelUDPTargetOnly"` // Shadowsocks PSK []byte `json:"psk"` UPSKs [][]byte `json:"uPSKs"` PaddingPolicy string `json:"paddingPolicy"` RejectPolicy string `json:"rejectPolicy"` // contains filtered or unexported fields }
ServerConfig stores a server configuration. It may be marshaled as or unmarshaled from JSON.
type ServiceConfig ¶
type ServiceConfig struct { Servers []ServerConfig `json:"servers"` Clients []ClientConfig `json:"clients"` DNS []dns.ResolverConfig `json:"dns"` Router router.RouterConfig `json:"router"` UDPBatchMode string `json:"udpBatchMode"` UDPBatchSize int `json:"udpBatchSize"` UDPPreferIPv6 bool `json:"udpPreferIPv6"` // contains filtered or unexported fields }
ServiceConfig is the main configuration structure. It may be marshaled as or unmarshaled from JSON. Call the Start method to start all configured services. Call the Stop method to properly close all running services.
type TCPRelay ¶
type TCPRelay struct {
// contains filtered or unexported fields
}
TCPRelay is a relay service for TCP traffic.
When started, the relay service accepts incoming TCP connections on the server, and dispatches them to a client selected by the router.
TCPRelay implements the Service interface.
func NewTCPRelay ¶
type UDPNATRelay ¶
type UDPNATRelay struct {
// contains filtered or unexported fields
}
UDPNATRelay is an address-based UDP relay service.
Incoming UDP packets are dispatched to NAT sessions based on the source address and port.
func NewUDPNATRelay ¶
func NewUDPNATRelay( batchMode, serverName, listenAddress string, batchSize, listenerFwmark, mtu, maxClientFrontHeadroom, maxClientRearHeadroom int, preferIPv6 bool, server zerocopy.UDPNATServer, router *router.Router, logger *zap.Logger, ) *UDPNATRelay
func (*UDPNATRelay) Start ¶
func (s *UDPNATRelay) Start() error
Start implements the Service Start method.
func (*UDPNATRelay) Stop ¶
func (s *UDPNATRelay) Stop() error
Stop implements the Service Stop method.
func (*UDPNATRelay) String ¶
func (s *UDPNATRelay) String() string
String implements the Service String method.
type UDPSessionRelay ¶
type UDPSessionRelay struct {
// contains filtered or unexported fields
}
UDPSessionRelay is a session-based UDP relay service.
Incoming UDP packets are dispatched to NAT sessions based on the client session ID.
func NewUDPSessionRelay ¶
func NewUDPSessionRelay( batchMode, serverName, listenAddress string, batchSize, listenerFwmark, mtu, maxClientFrontHeadroom, maxClientRearHeadroom int, preferIPv6 bool, server zerocopy.UDPSessionServer, router *router.Router, logger *zap.Logger, ) *UDPSessionRelay
func (*UDPSessionRelay) Start ¶
func (s *UDPSessionRelay) Start() error
Start implements the Service Start method.
func (*UDPSessionRelay) Stop ¶
func (s *UDPSessionRelay) Stop() error
Stop implements the Service Stop method.
func (*UDPSessionRelay) String ¶
func (s *UDPSessionRelay) String() string
String implements the Service String method.