easyss

package module
v2.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 46 Imported by: 0

README

Easyss

Easyss是一款兼容socks5的安全代理上网工具,目标是使访问国外技术网站更流畅免受干扰。

有报道表明访问国外技术网站正变得越来越困难,即使用了一些常用代理技术也面临被干扰的可能性。 为了以防万一,提前准备,重新实现了一套协议以加快访问速度和对抗嗅探。

特性

  • 简单稳定易用, 没有复杂的配置项; 无流量特征,不易被嗅探
  • 全平台支持(Linux, MacOS, Windows, Android等)
  • 支持SOCKS5(TCP/UDP, thanks socks5)、HTTP 代理协议
  • 支持浏览器级别代理(设置系统代理), 和系统全局代理(thanks tun2socks); 可选代理规则
  • 支持TCP连接池 (默认启用,大幅降低请求延迟)
  • 支持系统托盘图标管理 (thanks systray)
  • 可配置多服务器切换; 自定义直连白名单(IP/域名)
  • 基于TLS底层传输(可禁用); 上层支持AEAD类型高强度加密通信, 如aes-256-gcm, chacha20-poly1305
  • http2帧格式交互 (更灵活通用, 更易扩展)
  • 支持多种出口协议: native, http, https; 以适应各种复杂场景
  • 支持服务端(easyss-server)链式代理
  • 内建DNS服务器,支持DNS Forward转发,可用于透明代理部署时使用 (默认关闭,可通过命令行启用)

下载安装

在release页面直接下载(各平台)编译好的二进制文件

去下载

或者 通过源码安装(go version 1.21+ is required)
// Ubuntu20.04 or Debian11 
apt-get install gcc libgtk-3-dev libayatana-appindicator3-dev -y

// Ubuntu18.04 or Debian10
apt-get install gcc libgtk-3-dev libappindicator3-dev -y

// build easyss client
make easyss

// build easyss server
make easyss-server

用法

客户端

创建配置文件:config.json,并把配置文件放入easyss二进制相同目录中。

单服务器配置文件示例:

{
  "server": "your-domain.com",
  "server_port": 9999,
  "password": "your-pass",
  "local_port": 2080,
  "method": "aes-256-gcm",
  "timeout": 60,
  "bind_all": false,
  "outbound_proto": "native",
  "log_file_path": "easyss.log"
}

多服务器配置文件示例:

{
  "server_list": [
    {
      "server": "your-domain.com",
      "server_port": 7878,
      "password": "your-pass",
      "default": true
    },
    {
      "server": "your-domain2.com",
      "server_port": 9898,
      "password": "your-pass2"
    }
  ],
  "local_port": 2080,
  "method": "aes-256-gcm",
  "timeout": 60,
  "bind_all": false,
  "ca_path": "",
  "log_file_path": "easyss.log"
}

参数说明:

  • server: 服务器地址(必填,没有配置自定义证书情况下,必须是域名不能是IP,使用自定义证书可以是IP)
  • server_port: 服务器对应端口(必填)
  • password: 通信加密密钥(必填)
  • local_port: 本地监听端口(默认2080)
  • method: 通信加密方式(默认aes-256-gcm)
  • timeout: 超时时间,单位秒(默认60)
  • bind_all: 是否将监听端口绑定到所有本地IP上(默认false)
  • ca_path: 自定义CA证书文件路径(当使用自定义tls证书时才配置)
  • outbound_proto: 出口协议,默认native,可选:native, http, https
  • log_file_path: 日志文件路径,为空则输出到系统标准输出

其他还有一些参数没有列出,如无必要,无需关心。除了3个必填的参数,其他都是可选的,甚至可以不要配置文件,全部通过命令行指定即可。

如需查看完整配置参数,可执行:./easyss -show-config-example

保存好配置文件后,双击easyss,程序会自动启动,托盘会出现Easyss的图标,如下:

托盘图标 托盘图标 托盘图标

右键图标可选择代理规则和代理对象。

注意:代理对象,选择系统全局流量时,需要管理员权限。

自定义直连白名单:

对于少部分国内的IP/域名,或者部分特殊的IP/域名,可能Easyss没有正确识别,造成本该直连的IP/域名走了代理, 这时可在easyss所在目录下, 新建direct_ips.txt, direct_domains.txt, 分别用于存储直连IP列表和直连域名列表,每行一条记录。

direct_ips.txt文件示例:

39.156.66.10
110.242.68.66
106.11.84.3
206.0.68.0/23

direct_domains.txt文件示例:

baidu.com
taobao.com
your-custom-domain.com
手机客户端

手机客户端EasyssTun.apk文件可直接在release页面下载。

注意: 可将常用的国内大流量APP勾选上跳过,这样可减少电量消耗。当然不选也没关系,Easyss会自动判断该直连还是走代理。

服务器端

和客户端一样, 同样先创建配置文件config.json,并配置文件和二进制easyss-server放同一目录中。

服务端配置文件示例:

{
    "server": "your-domain.com",
    "server_port": 9999,
    "password": "your-pass",
    "timeout": 60,
    "cert_path": "",
    "key_path": ""
}

保存config.json文件, 其中server(在没有使用自定义证书情况下必填且为服务器域名地址)、server_portpassword必填, cert_path, key_path只有在使用自定义证书时配置,这两参数不为空则表示使用自定义tls证书,而非自动获取。

执行:

./easyss-server

注意:在没有使用自定义证书且没有禁用TLS情况下,服务器的443端口必须对外可访问,用于自动获取服务器域名证书的TLS校验使用。 并且这种情况需要sudo权限运行easyss-server

docker部署

docker run -d --name easyss --network host nange/docker-easyss:latest -p yourport -k yourpassword -s yourdomain.com

自定义证书

默认情况下,easyss-server端部署时配置了域名,则会自动从Let's Encrypt获取tls证书,用户无需操心证书配置。 但这要求我们必须有自己的域名,这加大了使用Easyss的难度。如果我们没有自己的域名,也可以通过自定义tls证书来使用Easyss。

生成自定义证书

可根据自己的需求,使用openssl等工具生成自定义证书。也可以参考: ./scripts/self_signed_certs 目录示例,使用cfssl生成自定义证书。 示例就是使用IP而不是域名生成自定义证书,这样就可以无域名使用Easyss了。

高级用法

服务器部署在反向代理之后

默认Easyss的出口协议为native,是基于TCP的一种特有协议。 但由于各种网络情况的客观复杂性,有可能我们的Easyss-server服务器只能部署于HTTP(s)反向代理之后的, 这时候native协议将无法工作,因此easyss支持了三种出口协议可选:native, http, httpshttphttps出口协议是对native的包装,基于tcp over http(s)技术实现。 如果可能的话应该优先使用native协议,因为其性能和延迟都有最好的表现。

在Easyss配置文件中,指定outbound_proto: http 或者 outbound_proto: https, 并在Easyss-server配置文件中,指定enable_http_inbound: true,即可实现服务器部署在反向代理之后的场景。 如果outbound_proto: http,还需要在Easyss-server配置文件中禁用tls:disable_tls: true

启动前或定期执行自定义命令

同时Easyss还支持配置cmd_before_startup, cmd_interval参数,用于配置一个自定义命令,在Easyss启动前执行或者定期的执行。 cmd_interval_time可用于控制定期执行间隔,默认10分钟执行一次。

作为透明代理将Easyss部署在路由器或者软路由上

直接将Easyss部署在路由器或这软路由上,可实现家里或公司网络自动透明代理,无需在终端设备上安装Easyss客户端。

只需要在配置文件或者命令行指定enable_tun2socks: true 或者 -enable-tun2socks=true开启全局代理, 并同时开启DNS流量转发enable_forward_dns: true 或者-enable-forward-dns=true,即可实现透明代理。

服务端链式代理

服务端(easyss-server)支持将请求再次转发给下一个代理(目前只支持socks5)。 如服务器IP被ChatGPT屏蔽了,可以在服务器上部署上Warp,然后easyss-server将ChatGPT相关的请求转发给Warp,这样可突破ChatGPT的封锁。

只需要在配置文件中指定next_proxy_url: "socks5://your-ip:your-port", 然后在easyss-server目录下创建next_proxy_domains.txt, next_proxy_ips.txt文件,用于指定对哪些域名或IP地址走链式代理。 也可以在配置文件中手动指定自定义文件路径:next_proxy_domains_file: "your_custom_domain_file.txt", next_proxy_ips_file: "your_custom_ip_file.txt"。 如果想链式代理所有地址的请求,则可以配置:enable_next_proxy_all_host: true

另外需要注意的是,链式代理默认是不转发UDP请求的,主要原因是很多socks5代理都不支持UDP请求,如Warp就不支持。 如果确定自己的代理是支持UDP请求的,又想开启UDP请求链式代理,则可以配置: enable_next_proxy_udp: true

LICENSE

MIT License

Documentation

Index

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 = 40
	MaxIdle     int = 5
	IdleTime        = time.Minute
	MaxLifetime     = 15 * time.Minute
)
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{"dnspod.cn", "alidns.com", "dudns.baidu.com"}
View Source
var DefaultDirectDNSServers = [3]string{"119.29.29.29:53", "223.5.5.5:53", "180.76.76.76:53"}

DefaultDirectDNSServers the servers are dns servers from tencent, aliyun and baidu

View Source
var T2SSStringToType = map[string]Tun2socksStatus{
	"off": Tun2socksStatusOff,
	"on":  Tun2socksStatusOn,
}
View Source
var T2SSTypeToString = map[Tun2socksStatus]string{
	Tun2socksStatusOff: "off",
	Tun2socksStatusOn:  "on",
}

Functions

func AllMethod added in v2.4.0

func AllMethod() []string

func AllOutboundProto added in v2.4.2

func AllOutboundProto() []string

func AllProxyRule added in v2.4.0

func AllProxyRule() []string

func CloseWrite

func CloseWrite(conn net.Conn) error

func Daemon

func Daemon(godaemon bool)

func DecodeCipherMethod

func DecodeCipherMethod(b byte) string

func EncodeCipherMethod

func EncodeCipherMethod(m string) byte

func ErrorCanIgnore

func ErrorCanIgnore(err error) bool

func ExampleJSONConfig

func ExampleJSONConfig() string

func ExampleServerJSONConfig

func ExampleServerJSONConfig() string

func NewDNSForwardServer

func NewDNSForwardServer(dnsServer string) *dns.Server

func OverrideConfig

func OverrideConfig[T any](dst, src *T)

func ParseConfig

func ParseConfig[T any](path string) (config *T, err error)

func ReadACKFromCipher

func ReadACKFromCipher(conn net.Conn) error

func WriteACKToCipher

func WriteACKToCipher(conn net.Conn) error

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"`
	DisableIPV6       bool           `json:"disable_ipv6"`
	DisableTLS        bool           `json:"disable_tls"`
	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"`
	CAPath            string         `json:"ca_path"`
	OutboundProto     string         `json:"outbound_proto"`
	CMDBeforeStartup  string         `json:"cmd_before_startup"`
	CMDInterval       string         `json:"cmd_interval"`
	CMDIntervalTime   int            `json:"cmd_interval_time"`
	ConfigFile        string         `json:"-"`
}

func (*Config) Clone

func (c *Config) Clone() *Config

func (*Config) DefaultServerConfigFrom added in v2.1.0

func (c *Config) DefaultServerConfigFrom(list []ServerConfig) *ServerConfig

func (*Config) GetLogFilePath added in v2.4.0

func (c *Config) GetLogFilePath() string

func (*Config) OverrideFrom added in v2.1.0

func (c *Config) OverrideFrom(sc *ServerConfig)

func (*Config) SetDefaultValue

func (c *Config) SetDefaultValue()

func (*Config) Validate

func (c *Config) Validate() error

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) 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) 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 New

func New(config *Config) (*Easyss, error)

func (*Easyss) AuthPassword added in v2.2.0

func (ss *Easyss) AuthPassword() string

func (*Easyss) AuthUsername added in v2.2.0

func (ss *Easyss) AuthUsername() string

func (*Easyss) AvailableConn added in v2.1.0

func (ss *Easyss) AvailableConn(needPingACK ...bool) (conn net.Conn, err error)

func (*Easyss) BindAll

func (ss *Easyss) BindAll() bool

func (*Easyss) CAPath

func (ss *Easyss) CAPath() string

func (*Easyss) CMDTimeout added in v2.3.0

func (ss *Easyss) CMDTimeout() time.Duration

func (*Easyss) Close

func (ss *Easyss) Close() error

func (*Easyss) CloseTun2socks

func (ss *Easyss) CloseTun2socks() error

func (*Easyss) ConfigClone

func (ss *Easyss) ConfigClone() *Config

func (*Easyss) ConfigFilename

func (ss *Easyss) ConfigFilename() string

func (*Easyss) CreateTun2socks

func (ss *Easyss) CreateTun2socks() error

func (*Easyss) DNSCache

func (ss *Easyss) DNSCache(name, qtype string, isDirect bool) *dns.Msg

func (*Easyss) DNSMsg

func (ss *Easyss) DNSMsg(dnsServer, domain string) (*dns.Msg, *dns.Msg, error)

func (*Easyss) DirectDNSServer

func (ss *Easyss) DirectDNSServer() string

func (*Easyss) DisableIPV6

func (ss *Easyss) DisableIPV6() bool

func (*Easyss) DisableSysProxy

func (ss *Easyss) DisableSysProxy() bool

func (*Easyss) DisableTLS added in v2.1.0

func (ss *Easyss) DisableTLS() bool

func (*Easyss) EnableForwardDNS

func (ss *Easyss) EnableForwardDNS() bool

func (*Easyss) EnabledTun2socks

func (ss *Easyss) EnabledTun2socks() bool

func (*Easyss) EnabledTun2socksFromConfig

func (ss *Easyss) EnabledTun2socksFromConfig() bool

func (*Easyss) HTTPOutboundClient added in v2.1.0

func (ss *Easyss) HTTPOutboundClient() *req.Client

func (*Easyss) HostAtCN added in v2.4.0

func (ss *Easyss) HostAtCN(host string) bool

func (*Easyss) HostMatchCustomDirectConfig added in v2.3.0

func (ss *Easyss) HostMatchCustomDirectConfig(host string) bool

func (*Easyss) IPAtCN added in v2.4.0

func (ss *Easyss) IPAtCN(ip string) bool

func (*Easyss) InitTcpPool

func (ss *Easyss) InitTcpPool() error

func (*Easyss) IsHTTPOutboundProto added in v2.1.0

func (ss *Easyss) IsHTTPOutboundProto() bool

func (*Easyss) IsHTTPSOutboundProto added in v2.1.0

func (ss *Easyss) IsHTTPSOutboundProto() bool

func (*Easyss) IsLANHost added in v2.4.0

func (ss *Easyss) IsLANHost(host string) bool

func (*Easyss) IsNativeOutboundProto added in v2.1.0

func (ss *Easyss) IsNativeOutboundProto() bool

func (*Easyss) LocalAddr

func (ss *Easyss) LocalAddr() string

func (*Easyss) LocalDNSForward

func (ss *Easyss) LocalDNSForward()

func (*Easyss) LocalDevice

func (ss *Easyss) LocalDevice() string

func (*Easyss) LocalDeviceIndex

func (ss *Easyss) LocalDeviceIndex() int

func (*Easyss) LocalGateway

func (ss *Easyss) LocalGateway() string

func (*Easyss) LocalHTTPPort

func (ss *Easyss) LocalHTTPPort() int

func (*Easyss) LocalHttp

func (ss *Easyss) LocalHttp()

func (*Easyss) LocalHttpAddr

func (ss *Easyss) LocalHttpAddr() string

func (*Easyss) LocalPacPort

func (ss *Easyss) LocalPacPort() int

func (*Easyss) LocalPort

func (ss *Easyss) LocalPort() int

func (*Easyss) LocalSocks5

func (ss *Easyss) LocalSocks5()

func (*Easyss) LogFilePath added in v2.4.0

func (ss *Easyss) LogFilePath() string

func (*Easyss) MatchHostRule added in v2.4.0

func (ss *Easyss) MatchHostRule(host string) HostRule

func (*Easyss) Method

func (ss *Easyss) Method() string

func (*Easyss) OutboundProto added in v2.1.0

func (ss *Easyss) OutboundProto() string

func (*Easyss) Password

func (ss *Easyss) Password() string

func (*Easyss) PingLatencyCh added in v2.4.2

func (ss *Easyss) PingLatencyCh() chan string

func (*Easyss) PingTimeout added in v2.3.0

func (ss *Easyss) PingTimeout() time.Duration

func (*Easyss) Pool

func (ss *Easyss) Pool() easypool.Pool

func (*Easyss) ProxyRule

func (ss *Easyss) ProxyRule() ProxyRule

func (*Easyss) ReadDeadlineTimeout added in v2.4.0

func (ss *Easyss) ReadDeadlineTimeout() time.Duration

func (*Easyss) RenewDNSCache

func (ss *Easyss) RenewDNSCache(name, qtype string, isDirect bool) bool

func (*Easyss) Server

func (ss *Easyss) Server() string

func (*Easyss) ServerAddr

func (ss *Easyss) ServerAddr() string

func (*Easyss) ServerIP

func (ss *Easyss) ServerIP() string

func (*Easyss) ServerList

func (ss *Easyss) ServerList() []ServerConfig

func (*Easyss) ServerListAddrs

func (ss *Easyss) ServerListAddrs() []string

func (*Easyss) ServerPort

func (ss *Easyss) ServerPort() int

func (*Easyss) SetDNSCache

func (ss *Easyss) SetDNSCache(msg *dns.Msg, noExpire, isDirect bool) error

func (*Easyss) SetDNSCacheIfNeeded

func (ss *Easyss) SetDNSCacheIfNeeded(udpResp []byte, isDirect bool) *dns.Msg

func (*Easyss) SetForwardDNSServer

func (ss *Easyss) SetForwardDNSServer(server *dns.Server)

func (*Easyss) SetHttpProxyServer

func (ss *Easyss) SetHttpProxyServer(server *http.Server)

func (*Easyss) SetPool

func (ss *Easyss) SetPool(pool easypool.Pool)

func (*Easyss) SetProxyRule

func (ss *Easyss) SetProxyRule(rule ProxyRule)

func (*Easyss) SetSocksServer

func (ss *Easyss) SetSocksServer(server *socks5.Server)

func (*Easyss) SetSysProxyOffHTTP

func (ss *Easyss) SetSysProxyOffHTTP() error

func (*Easyss) SetSysProxyOnHTTP

func (ss *Easyss) SetSysProxyOnHTTP() error

func (*Easyss) SetTun2socks

func (ss *Easyss) SetTun2socks(enable bool)

func (*Easyss) Socks5ProxyAddr

func (ss *Easyss) Socks5ProxyAddr() string

func (*Easyss) TCPHandle

func (ss *Easyss) TCPHandle(s *socks5.Server, conn *net.TCPConn, r *socks5.Request) error

func (*Easyss) TLSTimeout added in v2.3.0

func (ss *Easyss) TLSTimeout() time.Duration

func (*Easyss) Timeout

func (ss *Easyss) Timeout() time.Duration

func (*Easyss) TunConfig added in v2.4.0

func (ss *Easyss) TunConfig() *TunConfig

func (*Easyss) UDPHandle

func (ss *Easyss) UDPHandle(s *socks5.Server, addr *net.UDPAddr, d *socks5.Datagram) error

type GeoSite

type GeoSite struct {
	// contains filtered or unexported fields
}

func NewGeoSite

func NewGeoSite(data []byte) *GeoSite

func (*GeoSite) FullMatch added in v2.4.0

func (gs *GeoSite) FullMatch(domain string) bool

func (*GeoSite) SimpleMatch added in v2.4.0

func (gs *GeoSite) SimpleMatch(domain string, matchSub bool) bool

type HostRule added in v2.4.0

type HostRule int
const (
	HostRuleProxy HostRule = iota
	HostRuleDirect
	HostRuleBlock
)

type ProxyRule

type ProxyRule int
const (
	ProxyRuleUnknown ProxyRule = iota
	ProxyRuleAuto
	ProxyRuleReverseAuto
	ProxyRuleProxy
	ProxyRuleDirect
	ProxyRuleAutoBlock
)

func ParseProxyRuleFromString

func ParseProxyRuleFromString(rule string) ProxyRule

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"`
	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"`
	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 Statistics

type Statistics struct {
	BytesSend    atomic.Int64
	BytesReceive atomic.Int64
}

type Tun2socksStatus

type Tun2socksStatus int
const (
	Tun2socksStatusOff Tun2socksStatus = iota
	Tun2socksStatusOn
)

func (Tun2socksStatus) String

func (t2ss Tun2socksStatus) String() string

type TunConfig added in v2.4.0

type TunConfig struct {
	TunDevice string `json:"tun_device"`
	TunIP     string `json:"tun_ip"`
	TunGW     string `json:"tun_gw"`
	TunMask   string `json:"tun_mask"`
}

func (*TunConfig) IPSub added in v2.4.0

func (tc *TunConfig) IPSub() string

type UDPExchange

type UDPExchange struct {
	ClientAddr *net.UDPAddr
	RemoteConn net.Conn
}

UDPExchange used to store client address and remote connection

Directories

Path Synopsis
cmd
bytespool
Package bytespool provides a pool of []byte.
Package bytespool provides a pool of []byte.

Jump to

Keyboard shortcuts

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