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"` // Taint UnsafeRequestStreamPrefix []byte `json:"unsafeRequestStreamPrefix"` UnsafeResponseStreamPrefix []byte `json:"unsafeResponseStreamPrefix"` // contains filtered or unexported fields }
ClientConfig stores a client configuration. It may be marshaled as or unmarshaled from JSON.
type Config ¶ added in v1.3.0
type Config struct { Servers []ServerConfig `json:"servers"` Clients []ClientConfig `json:"clients"` DNS []dns.ResolverConfig `json:"dns"` Router router.Config `json:"router"` }
Config is the main configuration structure. It may be marshaled as or unmarshaled from JSON.
type Manager ¶ added in v1.5.0
type Manager struct {
// contains filtered or unexported fields
}
Manager manages the services.
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.
func NewUDPTransparentRelay ¶ added in v1.4.0
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"` NatTimeoutSec int `json:"natTimeoutSec"` // UDP performance tuning UDPBatchMode string `json:"udpBatchMode"` UDPRelayBatchSize int `json:"udpRelayBatchSize"` UDPServerRecvBatchSize int `json:"udpServerRecvBatchSize"` UDPSendChannelCapacity int `json:"udpSendChannelCapacity"` // 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"` // Taint UnsafeFallbackAddress *conn.Addr `json:"unsafeFallbackAddress"` UnsafeRequestStreamPrefix []byte `json:"unsafeRequestStreamPrefix"` UnsafeResponseStreamPrefix []byte `json:"unsafeResponseStreamPrefix"` // contains filtered or unexported fields }
ServerConfig stores a server configuration. It may be marshaled as or unmarshaled from JSON.
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, relayBatchSize, serverRecvBatchSize, sendChannelCapacity, listenerFwmark, mtu, maxClientFrontHeadroom, maxClientRearHeadroom int, natTimeout time.Duration, 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, relayBatchSize, serverRecvBatchSize, sendChannelCapacity, listenerFwmark, mtu, maxClientFrontHeadroom, maxClientRearHeadroom int, natTimeout time.Duration, 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.
type UDPTransparentRelay ¶ added in v1.4.0
type UDPTransparentRelay struct {
// contains filtered or unexported fields
}
UDPTransparentRelay is like UDPNATRelay, but for transparent proxy.
func (*UDPTransparentRelay) Start ¶ added in v1.4.0
func (s *UDPTransparentRelay) Start() error
Start implements the Relay Start method.
func (*UDPTransparentRelay) Stop ¶ added in v1.4.0
func (s *UDPTransparentRelay) Stop() error
Stop implements the Relay Stop method.
func (*UDPTransparentRelay) String ¶ added in v1.4.0
func (s *UDPTransparentRelay) String() string
String implements the Relay String method.