Documentation
¶
Index ¶
- Constants
- Variables
- func AllIPV6Rule() []string
- func AllMethod() []string
- func AllOutboundProto() []string
- func AllProxyRule() []string
- func CloseWrite(conn net.Conn) error
- func Daemon(godaemon bool)
- func DecodeCipherMethod(b byte) string
- func EncodeCipherMethod(m string) byte
- func ErrorCanIgnore(err error) bool
- func ExampleJSONConfig() string
- func ExampleServerJSONConfig() string
- func NewDNSForwardServer(dnsServer string) *dns.Server
- func OverrideConfig[T any](dst, src *T)
- func ParseConfig[T any](path string) (config *T, err error)
- func ReadACKFromCipher(conn net.Conn) error
- func WriteACKToCipher(conn net.Conn) error
- type Config
- type DirectUDPExchange
- type EasyServer
- func (es *EasyServer) CertPath() string
- func (es *EasyServer) Close() (err error)
- func (es *EasyServer) DisableTLS() bool
- func (es *EasyServer) Email() string
- func (es *EasyServer) EnableNextProxyALLHost() bool
- func (es *EasyServer) EnableNextProxyUDP() bool
- func (es *EasyServer) EnabledHTTPInbound() bool
- func (es *EasyServer) HTTPInboundPort() int
- func (es *EasyServer) KeyPath() string
- func (es *EasyServer) ListenAddr() string
- func (es *EasyServer) ListenHTTPTunnelAddr() string
- func (es *EasyServer) MaxConnWaitTimeout() time.Duration
- func (es *EasyServer) NextProxyDomainsFile() string
- func (es *EasyServer) NextProxyIPsFile() string
- func (es *EasyServer) NextProxyURL() *url.URL
- func (es *EasyServer) Password() string
- func (es *EasyServer) Server() string
- func (es *EasyServer) ServerPort() int
- func (es *EasyServer) Start()
- func (es *EasyServer) Timeout() time.Duration
- type Easyss
- func (ss *Easyss) AuthPassword() string
- func (ss *Easyss) AuthUsername() string
- func (ss *Easyss) AvailableConn(needPingACK ...bool) (conn net.Conn, err error)
- func (ss *Easyss) BindAll() bool
- func (ss *Easyss) CAPath() string
- func (ss *Easyss) CMDTimeout() time.Duration
- func (ss *Easyss) Close() error
- func (ss *Easyss) CloseTun2socks() error
- func (ss *Easyss) Closed() bool
- func (ss *Easyss) Config() *Config
- func (ss *Easyss) ConfigFilename() string
- func (ss *Easyss) CreateTun2socks() error
- func (ss *Easyss) CurrConfig() *Config
- func (ss *Easyss) DNSCache(name, qtype string, isDirect bool) *dns.Msg
- func (ss *Easyss) DNSMsg(dnsServer, domain string) (*dns.Msg, *dns.Msg, error)
- func (ss *Easyss) DirectDNSServer() string
- func (ss *Easyss) DisableQUIC() bool
- func (ss *Easyss) DisableSysProxy() bool
- func (ss *Easyss) DisableTLS() bool
- func (ss *Easyss) EnableForwardDNS() bool
- func (ss *Easyss) EnabledTun2socks() bool
- func (ss *Easyss) EnabledTun2socksFromConfig() bool
- func (ss *Easyss) HTTPOutboundClient() *req.Client
- func (ss *Easyss) HostAtCN(host string) bool
- func (ss *Easyss) HostMatchCustomDirectConfig(host string) bool
- func (ss *Easyss) IPAtCN(ip string) bool
- func (ss *Easyss) InitTcpPool() error
- func (ss *Easyss) IsHTTPOutboundProto() bool
- func (ss *Easyss) IsHTTPSOutboundProto() bool
- func (ss *Easyss) IsLANHost(host string) bool
- func (ss *Easyss) IsNativeOutboundProto() bool
- func (ss *Easyss) LocalAddr() string
- func (ss *Easyss) LocalDNSForward()
- func (ss *Easyss) LocalDevice() string
- func (ss *Easyss) LocalDeviceIndex() int
- func (ss *Easyss) LocalDeviceIndexV6() int
- func (ss *Easyss) LocalDeviceV6() string
- func (ss *Easyss) LocalGateway() string
- func (ss *Easyss) LocalGatewayV6() string
- func (ss *Easyss) LocalHTTPPort() int
- func (ss *Easyss) LocalHttp()
- func (ss *Easyss) LocalHttpAddr() string
- func (ss *Easyss) LocalPacPort() int
- func (ss *Easyss) LocalPort() int
- func (ss *Easyss) LocalSocks5()
- func (ss *Easyss) LogFilePath() string
- func (ss *Easyss) MatchHostRule(host string) HostRule
- func (ss *Easyss) MaxLifeTime() time.Duration
- func (ss *Easyss) Method() string
- func (ss *Easyss) OutboundProto() string
- func (ss *Easyss) Password() string
- func (ss *Easyss) PingLatencyCh() chan string
- func (ss *Easyss) PingTimeout() time.Duration
- func (ss *Easyss) Pool() easypool.Pool
- func (ss *Easyss) PoolConn() (net.Conn, error)
- func (ss *Easyss) ProxyRule() ProxyRule
- func (ss *Easyss) ReadDeadlineTimeout() time.Duration
- func (ss *Easyss) RenewDNSCache(name, qtype string, isDirect bool) bool
- func (ss *Easyss) Server() string
- func (ss *Easyss) ServerAddr() string
- func (ss *Easyss) ServerIP() string
- func (ss *Easyss) ServerIPV6() string
- func (ss *Easyss) ServerList() []*ServerConfig
- func (ss *Easyss) ServerListAddrs() []string
- func (ss *Easyss) ServerName() string
- func (ss *Easyss) ServerPort() int
- func (ss *Easyss) SetDNSCache(msg *dns.Msg, noExpire, isDirect bool) error
- func (ss *Easyss) SetDNSCacheIfNeeded(udpResp []byte, isDirect bool) *dns.Msg
- func (ss *Easyss) SetForwardDNSServer(server *dns.Server)
- func (ss *Easyss) SetHttpProxyServer(server *http.Server)
- func (ss *Easyss) SetProxyRule(rule ProxyRule)
- func (ss *Easyss) SetSocksServer(server *socks5.Server)
- func (ss *Easyss) SetSysProxyOffHTTP() error
- func (ss *Easyss) SetSysProxyOnHTTP() error
- func (ss *Easyss) SetTun2socks(enable bool)
- func (ss *Easyss) ShouldIPV6Disable() bool
- func (ss *Easyss) Socks5ProxyAddr() string
- func (ss *Easyss) TCPHandle(s *socks5.Server, conn *net.TCPConn, r *socks5.Request) error
- func (ss *Easyss) TLSTimeout() time.Duration
- func (ss *Easyss) Timeout() time.Duration
- func (ss *Easyss) TunConfig() *TunConfig
- func (ss *Easyss) UDPHandle(s *socks5.Server, addr *net.UDPAddr, d *socks5.Datagram) error
- type GeoSite
- type HostRule
- type IPV6Rule
- type ProxyRule
- type ServerConfig
- type Statistics
- type Tun2socksStatus
- type TunConfig
- type UDPExchange
Constants ¶
View Source
const ( OutboundProtoNative = "native" OutboundProtoHTTP = "http" OutboundProtoHTTPS = "https" )
View Source
const ( // DefaultDNSCacheSize set default dns cache size to 2MB DefaultDNSCacheSize = 2 * 1024 * 1024 // DefaultDNSCacheSec the default expire time for dns cache DefaultDNSCacheSec = 2 * 60 * 60 )
View Source
const ( UDPLocksCount = 512 UDPLocksAndOpVal = 511 )
View Source
const ( MaxCap int = 50 MaxIdle int = 5 )
View Source
const ( MaxUDPDataSize = 65507 DefaultDNSServer = "8.8.8.8:53" )
View Source
const DefaultDNSTimeout = 5 * time.Second
View Source
const DirectSuffix = "direct"
View Source
const RelayBufferSize = cipherstream.MaxCipherRelaySize
RelayBufferSize set to MaxCipherRelaySize
View Source
const RelayBufferSizeString = "24kb"
View Source
const UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
Variables ¶
View Source
var DefaultDNSServerDomains = [3]string{"alidns.com", "dnspod.cn", "dudns.baidu.com"}
View Source
var DefaultDirectDNSServers = [3]string{"223.5.5.5:53", "119.29.29.29:53", "180.76.76.76:53"}
DefaultDirectDNSServers the servers are dns servers from aliyun, tencent, and baidu
View Source
var T2SSStringToType = map[string]Tun2socksStatus{ "off": Tun2socksStatusOff, "on": Tun2socksStatusOn, }
View Source
var T2SSTypeToString = map[Tun2socksStatus]string{ Tun2socksStatusOff: "off", Tun2socksStatusOn: "on", }
View Source
var TLSCipherSuites = []uint16{ tls.TLS_AES_128_GCM_SHA256, tls.TLS_AES_256_GCM_SHA384, tls.TLS_CHACHA20_POLY1305_SHA256, tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, tls.TLS_RSA_WITH_AES_128_GCM_SHA256, tls.TLS_RSA_WITH_AES_256_GCM_SHA384, tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, tls.TLS_RSA_WITH_AES_256_CBC_SHA, tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA, tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, tls.TLS_RSA_WITH_RC4_128_SHA, tls.TLS_RSA_WITH_AES_128_CBC_SHA, tls.TLS_RSA_WITH_AES_128_CBC_SHA256, tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA, }
Functions ¶
func AllIPV6Rule ¶ added in v2.5.0
func AllIPV6Rule() []string
func AllOutboundProto ¶ added in v2.4.2
func AllOutboundProto() []string
func AllProxyRule ¶ added in v2.4.0
func AllProxyRule() []string
func CloseWrite ¶
func DecodeCipherMethod ¶
func EncodeCipherMethod ¶
func ErrorCanIgnore ¶
func ExampleJSONConfig ¶
func ExampleJSONConfig() string
func ExampleServerJSONConfig ¶
func ExampleServerJSONConfig() string
func NewDNSForwardServer ¶
func OverrideConfig ¶
func OverrideConfig[T any](dst, src *T)
func ParseConfig ¶
func ReadACKFromCipher ¶
func WriteACKToCipher ¶
Types ¶
type Config ¶
type Config struct { ServerList []*ServerConfig `json:"server_list,omitempty"` Server string `json:"server"` ServerPort int `json:"server_port"` LocalPort int `json:"local_port"` HTTPPort int `json:"http_port"` Password string `json:"password"` Method string `json:"method"` // encryption method LogLevel string `json:"log_level"` LogFilePath string `json:"log_file_path"` Timeout int `json:"timeout"` AuthUsername string `json:"auth_username"` AuthPassword string `json:"auth_password"` BindALL bool `json:"bind_all"` DisableSysProxy bool `json:"disable_sys_proxy"` DisableTLS bool `json:"disable_tls"` DisableQUIC bool `json:"disable_quic"` EnableForwardDNS bool `json:"enable_forward_dns"` EnableTun2socks bool `json:"enable_tun2socks"` TunConfig *TunConfig `json:"tun_config"` DirectIPsFile string `json:"direct_ips_file"` DirectDomainsFile string `json:"direct_domains_file"` ProxyRule string `json:"proxy_rule"` IPV6Rule string `json:"ipv6_rule"` CAPath string `json:"ca_path"` OutboundProto string `json:"outbound_proto"` SN string `json:"sn"` CMDBeforeStartup string `json:"cmd_before_startup"` CMDInterval string `json:"cmd_interval"` CMDIntervalTime int `json:"cmd_interval_time"` ConfigFile string `json:"-"` }
func (*Config) DefaultServerConfigFrom ¶ added in v2.1.0
func (c *Config) DefaultServerConfigFrom(list []*ServerConfig) *ServerConfig
func (*Config) GetLogFilePath ¶ added in v2.4.0
func (*Config) OverrideFrom ¶ added in v2.1.0
func (c *Config) OverrideFrom(sc *ServerConfig)
func (*Config) SetDefaultValue ¶
func (c *Config) SetDefaultValue()
type DirectUDPExchange ¶
type DirectUDPExchange struct { ClientAddr *net.UDPAddr RemoteConn net.PacketConn }
DirectUDPExchange used to store client address and remote connection
type EasyServer ¶
type EasyServer struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(config *ServerConfig) (*EasyServer, error)
func (*EasyServer) CertPath ¶
func (es *EasyServer) CertPath() string
func (*EasyServer) Close ¶
func (es *EasyServer) Close() (err error)
func (*EasyServer) DisableTLS ¶ added in v2.1.0
func (es *EasyServer) DisableTLS() bool
func (*EasyServer) Email ¶ added in v2.6.0
func (es *EasyServer) Email() string
func (*EasyServer) EnableNextProxyALLHost ¶ added in v2.2.0
func (es *EasyServer) EnableNextProxyALLHost() bool
func (*EasyServer) EnableNextProxyUDP ¶ added in v2.2.0
func (es *EasyServer) EnableNextProxyUDP() bool
func (*EasyServer) EnabledHTTPInbound ¶ added in v2.1.0
func (es *EasyServer) EnabledHTTPInbound() bool
func (*EasyServer) HTTPInboundPort ¶ added in v2.1.0
func (es *EasyServer) HTTPInboundPort() int
func (*EasyServer) KeyPath ¶
func (es *EasyServer) KeyPath() string
func (*EasyServer) ListenAddr ¶ added in v2.1.0
func (es *EasyServer) ListenAddr() string
func (*EasyServer) ListenHTTPTunnelAddr ¶ added in v2.1.0
func (es *EasyServer) ListenHTTPTunnelAddr() string
func (*EasyServer) MaxConnWaitTimeout ¶ added in v2.5.0
func (es *EasyServer) MaxConnWaitTimeout() time.Duration
func (*EasyServer) NextProxyDomainsFile ¶ added in v2.2.0
func (es *EasyServer) NextProxyDomainsFile() string
func (*EasyServer) NextProxyIPsFile ¶ added in v2.2.0
func (es *EasyServer) NextProxyIPsFile() string
func (*EasyServer) NextProxyURL ¶ added in v2.2.0
func (es *EasyServer) NextProxyURL() *url.URL
func (*EasyServer) Password ¶
func (es *EasyServer) Password() string
func (*EasyServer) Server ¶
func (es *EasyServer) Server() string
func (*EasyServer) ServerPort ¶
func (es *EasyServer) ServerPort() int
func (*EasyServer) Start ¶
func (es *EasyServer) Start()
func (*EasyServer) Timeout ¶
func (es *EasyServer) Timeout() time.Duration
type Easyss ¶
type Easyss struct {
// contains filtered or unexported fields
}
func (*Easyss) AuthPassword ¶ added in v2.2.0
func (*Easyss) AuthUsername ¶ added in v2.2.0
func (*Easyss) AvailableConn ¶ added in v2.1.0
func (*Easyss) CMDTimeout ¶ added in v2.3.0
func (*Easyss) CloseTun2socks ¶
func (*Easyss) ConfigFilename ¶
func (*Easyss) CreateTun2socks ¶
func (*Easyss) CurrConfig ¶ added in v2.6.0
func (*Easyss) DirectDNSServer ¶
func (*Easyss) DisableQUIC ¶ added in v2.4.3
func (*Easyss) DisableSysProxy ¶
func (*Easyss) DisableTLS ¶ added in v2.1.0
func (*Easyss) EnableForwardDNS ¶
func (*Easyss) EnabledTun2socks ¶
func (*Easyss) EnabledTun2socksFromConfig ¶
func (*Easyss) HTTPOutboundClient ¶ added in v2.1.0
func (ss *Easyss) HTTPOutboundClient() *req.Client
func (*Easyss) HostMatchCustomDirectConfig ¶ added in v2.3.0
func (*Easyss) InitTcpPool ¶
func (*Easyss) IsHTTPOutboundProto ¶ added in v2.1.0
func (*Easyss) IsHTTPSOutboundProto ¶ added in v2.1.0
func (*Easyss) IsNativeOutboundProto ¶ added in v2.1.0
func (*Easyss) LocalDNSForward ¶
func (ss *Easyss) LocalDNSForward()
func (*Easyss) LocalDevice ¶
func (*Easyss) LocalDeviceIndex ¶
func (*Easyss) LocalDeviceIndexV6 ¶ added in v2.5.0
func (*Easyss) LocalDeviceV6 ¶ added in v2.5.0
func (*Easyss) LocalGateway ¶
func (*Easyss) LocalGatewayV6 ¶ added in v2.5.0
func (*Easyss) LocalHTTPPort ¶
func (*Easyss) LocalHttpAddr ¶
func (*Easyss) LocalPacPort ¶
func (*Easyss) LocalSocks5 ¶
func (ss *Easyss) LocalSocks5()
func (*Easyss) LogFilePath ¶ added in v2.4.0
func (*Easyss) MatchHostRule ¶ added in v2.4.0
func (*Easyss) MaxLifeTime ¶ added in v2.5.0
func (*Easyss) OutboundProto ¶ added in v2.1.0
func (*Easyss) PingLatencyCh ¶ added in v2.4.2
func (*Easyss) PingTimeout ¶ added in v2.3.0
func (*Easyss) ReadDeadlineTimeout ¶ added in v2.4.0
func (*Easyss) RenewDNSCache ¶
func (*Easyss) ServerAddr ¶
func (*Easyss) ServerIPV6 ¶ added in v2.5.0
func (*Easyss) ServerList ¶
func (ss *Easyss) ServerList() []*ServerConfig
func (*Easyss) ServerListAddrs ¶
func (*Easyss) ServerName ¶ added in v2.5.0
func (*Easyss) ServerPort ¶
func (*Easyss) SetDNSCache ¶
func (*Easyss) SetDNSCacheIfNeeded ¶
func (*Easyss) SetForwardDNSServer ¶
func (*Easyss) SetHttpProxyServer ¶
func (*Easyss) SetProxyRule ¶
func (*Easyss) SetSocksServer ¶
func (*Easyss) SetSysProxyOffHTTP ¶
func (*Easyss) SetSysProxyOnHTTP ¶
func (*Easyss) SetTun2socks ¶
func (*Easyss) ShouldIPV6Disable ¶ added in v2.5.0
func (*Easyss) Socks5ProxyAddr ¶
func (*Easyss) TLSTimeout ¶ added in v2.3.0
type ServerConfig ¶
type ServerConfig struct { Server string `json:"server"` ServerPort int `json:"server_port"` Password string `json:"password"` Timeout int `json:"timeout"` LogLevel string `json:"log_level"` LogFilePath string `json:"log_file_path"` Email string `json:"email"` DisableTLS bool `json:"disable_tls"` CertPath string `json:"cert_path"` KeyPath string `json:"key_path"` EnableHTTPInbound bool `json:"enable_http_inbound"` HTTPInboundPort int `json:"http_inbound_port"` NextProxyURL string `json:"next_proxy_url"` NextProxyDomainsFile string `json:"next_proxy_domains_file"` NextProxyIPsFile string `json:"next_proxy_ips_file"` EnableNextProxyUDP bool `json:"enable_next_proxy_udp"` EnableNextProxyALLHost bool `json:"enable_next_proxy_all_host"` // the below fields only be used for easyss client CAPath string `json:"ca_path,omitempty"` Default bool `json:"default,omitempty"` OutboundProto string `json:"outbound_proto,omitempty"` SN string `json:"sn"` CMDBeforeStartup string `json:"cmd_before_startup,omitempty"` CMDInterval string `json:"cmd_interval,omitempty"` CMDIntervalTime int `json:"cmd_interval_time,omitempty"` }
func (*ServerConfig) GetLogFilePath ¶ added in v2.4.0
func (c *ServerConfig) GetLogFilePath() string
func (*ServerConfig) SetDefaultValue ¶
func (c *ServerConfig) SetDefaultValue()
func (*ServerConfig) Validate ¶
func (c *ServerConfig) Validate() error
type Tun2socksStatus ¶
type Tun2socksStatus int
const ( Tun2socksStatusOff Tun2socksStatus = iota Tun2socksStatusOn )
func (Tun2socksStatus) String ¶
func (t2ss Tun2socksStatus) String() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.