mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 09:25:41 +08:00
proxy: support registerable usage info
This commit is contained in:
parent
d05d71e591
commit
cc63a59f1e
217
README.md
217
README.md
@ -101,12 +101,16 @@ glider -h
|
|||||||
<summary>click to see details</summary>
|
<summary>click to see details</summary>
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
glider 0.16.0 usage:
|
Usage: glider [-listen URL]... [-forward URL]... [OPTION]...
|
||||||
|
e.g. glider -config /etc/glider/glider.conf
|
||||||
|
glider -listen :8443 -forward socks5://serverA:1080 -forward socks5://serverB:1080 -verbose
|
||||||
|
|
||||||
|
OPTION:
|
||||||
-check string
|
-check string
|
||||||
check=tcp[://HOST:PORT]: tcp port connect check
|
check=tcp[://HOST:PORT]: tcp port connect check
|
||||||
check=http://HOST[:PORT][/URI][#expect=REGEX_MATCH_IN_RESP_LINE]
|
check=http://HOST[:PORT][/URI][#expect=REGEX_MATCH_IN_RESP_LINE]
|
||||||
check=https://HOST[:PORT][/URI][#expect=REGEX_MATCH_IN_RESP_LINE]
|
check=https://HOST[:PORT][/URI][#expect=REGEX_MATCH_IN_RESP_LINE]
|
||||||
check=file://SCRIPT_PATH: run a check script, healthy when exitcode=0, environment variables: FORWARDER_ADDR,FORWARDER_URL
|
check=file://SCRIPT_PATH: run a check script, healthy when exitcode=0, env vars: FORWARDER_ADDR,FORWARDER_URL
|
||||||
check=disable: disable health check (default "http://www.msftconnecttest.com/connecttest.txt#expect=200")
|
check=disable: disable health check (default "http://www.msftconnecttest.com/connecttest.txt#expect=200")
|
||||||
-checkdisabledonly
|
-checkdisabledonly
|
||||||
check disabled fowarders only
|
check disabled fowarders only
|
||||||
@ -127,7 +131,7 @@ glider 0.16.0 usage:
|
|||||||
-dnscachelog
|
-dnscachelog
|
||||||
show query log of dns cache
|
show query log of dns cache
|
||||||
-dnscachesize int
|
-dnscachesize int
|
||||||
size of CACHE (default 4096)
|
max number of dns response in CACHE (default 4096)
|
||||||
-dnsmaxttl int
|
-dnsmaxttl int
|
||||||
maximum TTL value for entries in the CACHE(seconds) (default 1800)
|
maximum TTL value for entries in the CACHE(seconds) (default 1800)
|
||||||
-dnsminttl int
|
-dnsminttl int
|
||||||
@ -141,15 +145,15 @@ glider 0.16.0 usage:
|
|||||||
-dnstimeout int
|
-dnstimeout int
|
||||||
timeout value used in multiple dnsservers switch(seconds) (default 3)
|
timeout value used in multiple dnsservers switch(seconds) (default 3)
|
||||||
-forward value
|
-forward value
|
||||||
forward url, format: SCHEME://[USER|METHOD:PASSWORD@][HOST]:PORT?PARAMS[,SCHEME://[USER|METHOD:PASSWORD@][HOST]:PORT?PARAMS]
|
forward url, see the URL section below
|
||||||
-include value
|
-include value
|
||||||
include file
|
include file
|
||||||
-interface string
|
-interface string
|
||||||
source ip or source interface
|
source ip or source interface
|
||||||
-listen value
|
-listen value
|
||||||
listen url, format: SCHEME://[USER|METHOD:PASSWORD@][HOST]:PORT?PARAMS
|
listen url, see the URL section below
|
||||||
-logflags int
|
-logflags int
|
||||||
log flags, do not change it if you do not know what it is, ref: https://pkg.go.dev/log#pkg-constants (default 19)
|
do not change it if you do not know what it is, ref: https://pkg.go.dev/log#pkg-constants (default 19)
|
||||||
-maxfailures int
|
-maxfailures int
|
||||||
max failures to change forwarder status to disabled (default 3)
|
max failures to change forwarder status to disabled (default 3)
|
||||||
-relaytimeout int
|
-relaytimeout int
|
||||||
@ -158,23 +162,62 @@ glider 0.16.0 usage:
|
|||||||
rule file path
|
rule file path
|
||||||
-rules-dir string
|
-rules-dir string
|
||||||
rule file folder
|
rule file folder
|
||||||
|
-scheme string
|
||||||
|
show help message of proxy scheme, use 'all' to see all
|
||||||
-service value
|
-service value
|
||||||
run specified services, format: SERVICE_NAME[,SERVICE_CONFIG]
|
run specified services, format: SERVICE_NAME[,SERVICE_CONFIG]
|
||||||
-strategy string
|
-strategy string
|
||||||
forward strategy, default: rr (default "rr")
|
rr: Round Robin mode
|
||||||
|
ha: High Availability mode
|
||||||
|
lha: Latency based High Availability mode
|
||||||
|
dh: Destination Hashing mode (default "rr")
|
||||||
-tcpbufsize int
|
-tcpbufsize int
|
||||||
tcp buffer size in Bytes (default 32768)
|
tcp buffer size in Bytes (default 32768)
|
||||||
-udpbufsize int
|
-udpbufsize int
|
||||||
udp buffer size in Bytes (default 2048)
|
udp buffer size in Bytes (default 2048)
|
||||||
-verbose
|
-verbose
|
||||||
verbose mode
|
verbose mode
|
||||||
|
|
||||||
|
URL:
|
||||||
|
proxy: SCHEME://[USER:PASS@][HOST]:PORT
|
||||||
|
chain: proxy,proxy,[proxy]...
|
||||||
|
|
||||||
|
e.g. -listen socks5://:1080
|
||||||
|
-listen tls://:443?cert=crtFilePath&key=keyFilePath,http:// (protocol chain)
|
||||||
|
|
||||||
|
e.g. -forward socks5://server:1080
|
||||||
|
-forward tls://server.com:443,http:// (protocol chain)
|
||||||
|
-forward socks5://serverA:1080,socks5://serverB:1080 (proxy chain)
|
||||||
|
|
||||||
|
SCHEME:
|
||||||
|
listen : sni,mixed,tcp,tls,vless,http,ss,trojan,trojanc,wss,ws,kcp,socks5,pxyproto,smux,udp
|
||||||
|
forward: vmess,wss,simple-obfs,udp,ws,kcp,socks5,ssh,ssr,tls,trojanc,reject,socks4a,smux,socks4,ss,tcp,trojan,vless,direct,http
|
||||||
|
|
||||||
|
Note: use `glider -scheme all` or `glider -scheme SCHEME` to see help info for the scheme.
|
||||||
|
|
||||||
|
--
|
||||||
|
Forwarder Options: FORWARD_URL#OPTIONS
|
||||||
|
priority : the priority of that forwarder, the larger the higher, default: 0
|
||||||
|
interface: the local interface or ip address used to connect remote server.
|
||||||
|
|
||||||
|
e.g. -forward socks5://server:1080#priority=100
|
||||||
|
-forward socks5://server:1080#interface=eth0
|
||||||
|
-forward socks5://server:1080#priority=100&interface=192.168.1.99
|
||||||
|
|
||||||
|
Services:
|
||||||
|
dhcpd: service=dhcpd,INTERFACE,START_IP,END_IP,LEASE_MINUTES[,MAC=IP,MAC=IP...]
|
||||||
|
e.g. service=dhcpd,eth1,192.168.1.100,192.168.1.199,720
|
||||||
|
|
||||||
|
see README.md and glider.conf.example for more details.
|
||||||
|
--
|
||||||
|
glider v0.16.0, https://github.com/nadoo/glider
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
run:
|
run:
|
||||||
```bash
|
```bash
|
||||||
glider -config CONFIGPATH
|
glider -config CONFIG_PATH
|
||||||
```
|
```
|
||||||
```bash
|
```bash
|
||||||
glider -verbose -listen :8443 -forward SCHEME://HOST:PORT
|
glider -verbose -listen :8443 -forward SCHEME://HOST:PORT
|
||||||
@ -182,144 +225,118 @@ glider -verbose -listen :8443 -forward SCHEME://HOST:PORT
|
|||||||
|
|
||||||
#### Schemes
|
#### Schemes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
glider -scheme all
|
||||||
|
```
|
||||||
<details>
|
<details>
|
||||||
<summary>click to see details</summary>
|
<summary>click to see details</summary>
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
Available schemes:
|
KCP scheme:
|
||||||
listen: mixed ss socks5 http vless trojan trojanc redir redir6 tproxy tcp udp tls ws wss unix smux kcp pxyproto
|
kcp://CRYPT:KEY@host:port[?dataShards=NUM&parityShards=NUM&mode=MODE]
|
||||||
forward: direct reject ss socks4 socks5 http ssr ssh vless vmess trojan trojanc tcp udp tls ws wss unix smux kcp simple-obfs
|
|
||||||
|
Available crypt types for KCP:
|
||||||
|
none, sm4, tea, xor, aes, aes-128, aes-192, blowfish, twofish, cast5, 3des, xtea, salsa20
|
||||||
|
|
||||||
|
Available modes for KCP:
|
||||||
|
fast, fast2, fast3, normal, default: fast
|
||||||
|
|
||||||
|
--
|
||||||
Socks5 scheme:
|
Socks5 scheme:
|
||||||
socks://[user:pass@]host:port
|
socks://[user:pass@]host:port
|
||||||
|
|
||||||
|
--
|
||||||
|
Simple-Obfs scheme:
|
||||||
|
simple-obfs://host:port[?type=TYPE&host=HOST&uri=URI&ua=UA]
|
||||||
|
|
||||||
|
Available types for simple-obfs:
|
||||||
|
http, tls
|
||||||
|
|
||||||
|
--
|
||||||
|
Smux scheme:
|
||||||
|
smux://host:port
|
||||||
|
|
||||||
|
--
|
||||||
SS scheme:
|
SS scheme:
|
||||||
ss://method:pass@host:port
|
ss://method:pass@host:port
|
||||||
|
|
||||||
|
Available methods for ss:
|
||||||
|
AEAD Ciphers:
|
||||||
|
AEAD_AES_128_GCM AEAD_AES_192_GCM AEAD_AES_256_GCM AEAD_CHACHA20_POLY1305 AEAD_XCHACHA20_POLY1305
|
||||||
|
Stream Ciphers:
|
||||||
|
AES-128-CFB AES-128-CTR AES-192-CFB AES-192-CTR AES-256-CFB AES-256-CTR CHACHA20-IETF XCHACHA20 CHACHA20 RC4-MD5
|
||||||
|
Alias:
|
||||||
|
chacha20-ietf-poly1305 = AEAD_CHACHA20_POLY1305, xchacha20-ietf-poly1305 = AEAD_XCHACHA20_POLY1305
|
||||||
|
Plain: NONE
|
||||||
|
|
||||||
Available methods for ss:
|
--
|
||||||
AEAD Ciphers:
|
|
||||||
AEAD_AES_128_GCM AEAD_AES_192_GCM AEAD_AES_256_GCM AEAD_CHACHA20_POLY1305 AEAD_XCHACHA20_POLY1305
|
|
||||||
Stream Ciphers:
|
|
||||||
AES-128-CFB AES-128-CTR AES-192-CFB AES-192-CTR AES-256-CFB AES-256-CTR CHACHA20-IETF XCHACHA20 CHACHA20 RC4-MD5
|
|
||||||
Alias:
|
|
||||||
chacha20-ietf-poly1305 = AEAD_CHACHA20_POLY1305, xchacha20-ietf-poly1305 = AEAD_XCHACHA20_POLY1305
|
|
||||||
Plain: NONE
|
|
||||||
|
|
||||||
SSR scheme:
|
|
||||||
ssr://method:pass@host:port?protocol=xxx&protocol_param=yyy&obfs=zzz&obfs_param=xyz
|
|
||||||
|
|
||||||
SSH scheme:
|
SSH scheme:
|
||||||
ssh://user[:pass]@host:port[?key=keypath&timeout=SECONDS]
|
ssh://user[:pass]@host:port[?key=keypath&timeout=SECONDS]
|
||||||
timeout: timeout of ssh handshake and channel operation, default: 5
|
timeout: timeout of ssh handshake and channel operation, default: 5
|
||||||
|
|
||||||
VMess scheme:
|
--
|
||||||
vmess://[security:]uuid@host:port[?alterID=num]
|
SSR scheme:
|
||||||
if alterID=0 or not set, VMessAEAD will be enabled
|
ssr://method:pass@host:port?protocol=xxx&protocol_param=yyy&obfs=zzz&obfs_param=xyz
|
||||||
|
|
||||||
Available security for vmess:
|
|
||||||
zero, none, aes-128-gcm, chacha20-poly1305
|
|
||||||
|
|
||||||
VLESS scheme:
|
|
||||||
vless://uuid@host:port[?fallback=127.0.0.1:80]
|
|
||||||
|
|
||||||
Trojan client scheme:
|
|
||||||
trojan://pass@host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH]
|
|
||||||
trojanc://pass@host:port (cleartext, without TLS)
|
|
||||||
|
|
||||||
Trojan server scheme:
|
|
||||||
trojan://pass@host:port?cert=PATH&key=PATH[&fallback=127.0.0.1]
|
|
||||||
trojanc://pass@host:port[?fallback=127.0.0.1] (cleartext, without TLS)
|
|
||||||
|
|
||||||
|
--
|
||||||
TLS client scheme:
|
TLS client scheme:
|
||||||
tls://host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&alpn=proto1][&alpn=proto2]
|
tls://host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&alpn=proto1][&alpn=proto2]
|
||||||
|
|
||||||
Proxy over tls client:
|
Proxy over tls client:
|
||||||
tls://host:port[?skipVerify=true][&serverName=SERVERNAME],scheme://
|
tls://host:port[?skipVerify=true][&serverName=SERVERNAME],scheme://
|
||||||
tls://host:port[?skipVerify=true],http://[user:pass@]
|
tls://host:port[?skipVerify=true],http://[user:pass@]
|
||||||
tls://host:port[?skipVerify=true],socks5://[user:pass@]
|
tls://host:port[?skipVerify=true],socks5://[user:pass@]
|
||||||
tls://host:port[?skipVerify=true],vmess://[security:]uuid@?alterID=num
|
tls://host:port[?skipVerify=true],vmess://[security:]uuid@?alterID=num
|
||||||
|
|
||||||
TLS server scheme:
|
TLS server scheme:
|
||||||
tls://host:port?cert=PATH&key=PATH[&alpn=proto1][&alpn=proto2]
|
tls://host:port?cert=PATH&key=PATH[&alpn=proto1][&alpn=proto2]
|
||||||
|
|
||||||
Proxy over tls server:
|
Proxy over tls server:
|
||||||
tls://host:port?cert=PATH&key=PATH,scheme://
|
tls://host:port?cert=PATH&key=PATH,scheme://
|
||||||
tls://host:port?cert=PATH&key=PATH,http://
|
tls://host:port?cert=PATH&key=PATH,http://
|
||||||
tls://host:port?cert=PATH&key=PATH,socks5://
|
tls://host:port?cert=PATH&key=PATH,socks5://
|
||||||
tls://host:port?cert=PATH&key=PATH,ss://method:pass@
|
tls://host:port?cert=PATH&key=PATH,ss://method:pass@
|
||||||
|
|
||||||
|
--
|
||||||
|
Trojan client scheme:
|
||||||
|
trojan://pass@host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH]
|
||||||
|
trojanc://pass@host:port (cleartext, without TLS)
|
||||||
|
|
||||||
|
Trojan server scheme:
|
||||||
|
trojan://pass@host:port?cert=PATH&key=PATH[&fallback=127.0.0.1]
|
||||||
|
trojanc://pass@host:port[?fallback=127.0.0.1] (cleartext, without TLS)
|
||||||
|
|
||||||
|
--
|
||||||
|
VLESS scheme:
|
||||||
|
vless://uuid@host:port[?fallback=127.0.0.1:80]
|
||||||
|
|
||||||
|
--
|
||||||
|
VMess scheme:
|
||||||
|
vmess://[security:]uuid@host:port[?alterID=num]
|
||||||
|
if alterID=0 or not set, VMessAEAD will be enabled
|
||||||
|
|
||||||
|
Available security for vmess:
|
||||||
|
zero, none, aes-128-gcm, chacha20-poly1305
|
||||||
|
|
||||||
|
--
|
||||||
Websocket client scheme:
|
Websocket client scheme:
|
||||||
ws://host:port[/path][?host=HOST][&origin=ORIGIN]
|
ws://host:port[/path][?host=HOST][&origin=ORIGIN]
|
||||||
wss://host:port[/path][?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&host=HOST][&origin=ORIGIN]
|
wss://host:port[/path][?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&host=HOST][&origin=ORIGIN]
|
||||||
|
|
||||||
Websocket server scheme:
|
Websocket server scheme:
|
||||||
ws://:port[/path][?host=HOST]
|
ws://:port[/path][?host=HOST]
|
||||||
wss://:port[/path]?cert=PATH&key=PATH[?host=HOST]
|
wss://:port[/path]?cert=PATH&key=PATH[?host=HOST]
|
||||||
|
|
||||||
Websocket with a specified proxy protocol:
|
Websocket with a specified proxy protocol:
|
||||||
ws://host:port[/path][?host=HOST],scheme://
|
ws://host:port[/path][?host=HOST],scheme://
|
||||||
ws://host:port[/path][?host=HOST],http://[user:pass@]
|
ws://host:port[/path][?host=HOST],http://[user:pass@]
|
||||||
ws://host:port[/path][?host=HOST],socks5://[user:pass@]
|
ws://host:port[/path][?host=HOST],socks5://[user:pass@]
|
||||||
|
|
||||||
TLS and Websocket with a specified proxy protocol:
|
TLS and Websocket with a specified proxy protocol:
|
||||||
tls://host:port[?skipVerify=true][&serverName=SERVERNAME],ws://[@/path[?host=HOST]],scheme://
|
tls://host:port[?skipVerify=true][&serverName=SERVERNAME],ws://[@/path[?host=HOST]],scheme://
|
||||||
tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],http://[user:pass@]
|
tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],http://[user:pass@]
|
||||||
tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],socks5://[user:pass@]
|
tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],socks5://[user:pass@]
|
||||||
tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],vmess://[security:]uuid@?alterID=num
|
tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],vmess://[security:]uuid@?alterID=num
|
||||||
|
|
||||||
Unix domain socket scheme:
|
|
||||||
unix://path
|
|
||||||
|
|
||||||
Smux scheme:
|
|
||||||
smux://host:port
|
|
||||||
|
|
||||||
KCP scheme:
|
|
||||||
kcp://CRYPT:KEY@host:port[?dataShards=NUM&parityShards=NUM&mode=MODE]
|
|
||||||
|
|
||||||
Available crypt types for KCP:
|
|
||||||
none, sm4, tea, xor, aes, aes-128, aes-192, blowfish, twofish, cast5, 3des, xtea, salsa20
|
|
||||||
|
|
||||||
Available modes for KCP:
|
|
||||||
fast, fast2, fast3, normal, default: fast
|
|
||||||
|
|
||||||
Simple-Obfs scheme:
|
|
||||||
simple-obfs://host:port[?type=TYPE&host=HOST&uri=URI&ua=UA]
|
|
||||||
|
|
||||||
Available types for simple-obfs:
|
|
||||||
http, tls
|
|
||||||
|
|
||||||
DNS forwarding server:
|
|
||||||
dns=:53
|
|
||||||
dnsserver=8.8.8.8:53
|
|
||||||
dnsserver=1.1.1.1:53
|
|
||||||
dnsrecord=www.example.com/1.2.3.4
|
|
||||||
dnsrecord=www.example.com/2606:2800:220:1:248:1893:25c8:1946
|
|
||||||
|
|
||||||
Available forward strategies:
|
|
||||||
rr: Round Robin mode
|
|
||||||
ha: High Availability mode
|
|
||||||
lha: Latency based High Availability mode
|
|
||||||
dh: Destination Hashing mode
|
|
||||||
|
|
||||||
Forwarder option scheme: FORWARD_URL#OPTIONS
|
|
||||||
priority: set the priority of that forwarder, default:0
|
|
||||||
interface: set local interface or ip address used to connect remote server
|
|
||||||
-
|
|
||||||
Examples:
|
|
||||||
socks5://1.1.1.1:1080#priority=100
|
|
||||||
vmess://[security:]uuid@host:port?alterID=num#priority=200
|
|
||||||
vmess://[security:]uuid@host:port?alterID=num#priority=200&interface=192.168.1.99
|
|
||||||
vmess://[security:]uuid@host:port?alterID=num#priority=200&interface=eth0
|
|
||||||
|
|
||||||
Services:
|
|
||||||
dhcpd: service=dhcpd,INTERFACE,START_IP,END_IP,LEASE_MINUTES[,MAC=IP,MAC=IP...]
|
|
||||||
e.g.,service=dhcpd,eth1,192.168.1.100,192.168.1.199,720
|
|
||||||
|
|
||||||
Config file format(see `./glider.conf.example` as an example):
|
|
||||||
# COMMENT LINE
|
|
||||||
KEY=VALUE
|
|
||||||
KEY=VALUE
|
|
||||||
# KEY equals to command line flag name: listen forward strategy...
|
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
258
config.go
258
config.go
@ -43,15 +43,25 @@ func parseConfig() *Config {
|
|||||||
|
|
||||||
flag.SetOutput(os.Stdout)
|
flag.SetOutput(os.Stdout)
|
||||||
|
|
||||||
|
scheme := flag.String("scheme", "", "show help message of proxy scheme, use 'all' to see all ")
|
||||||
|
|
||||||
flag.BoolVar(&conf.Verbose, "verbose", false, "verbose mode")
|
flag.BoolVar(&conf.Verbose, "verbose", false, "verbose mode")
|
||||||
flag.IntVar(&conf.LogFlags, "logflags", 19, "log flags, do not change it if you do not know what it is, ref: https://pkg.go.dev/log#pkg-constants")
|
flag.IntVar(&conf.LogFlags, "logflags", 19, "do not change it if you do not know what it is, ref: https://pkg.go.dev/log#pkg-constants")
|
||||||
flag.IntVar(&conf.TCPBufSize, "tcpbufsize", 32768, "tcp buffer size in Bytes")
|
flag.IntVar(&conf.TCPBufSize, "tcpbufsize", 32768, "tcp buffer size in Bytes")
|
||||||
flag.IntVar(&conf.UDPBufSize, "udpbufsize", 2048, "udp buffer size in Bytes")
|
flag.IntVar(&conf.UDPBufSize, "udpbufsize", 2048, "udp buffer size in Bytes")
|
||||||
flag.StringSliceUniqVar(&conf.Listens, "listen", nil, "listen url, format: SCHEME://[USER|METHOD:PASSWORD@][HOST]:PORT?PARAMS")
|
flag.StringSliceUniqVar(&conf.Listens, "listen", nil, "listen url, see the URL section below")
|
||||||
|
|
||||||
flag.StringSliceVar(&conf.Forwards, "forward", nil, "forward url, format: SCHEME://[USER|METHOD:PASSWORD@][HOST]:PORT?PARAMS[,SCHEME://[USER|METHOD:PASSWORD@][HOST]:PORT?PARAMS]")
|
flag.StringSliceVar(&conf.Forwards, "forward", nil, "forward url, see the URL section below")
|
||||||
flag.StringVar(&conf.Strategy.Strategy, "strategy", "rr", "forward strategy, default: rr")
|
flag.StringVar(&conf.Strategy.Strategy, "strategy", "rr", `rr: Round Robin mode
|
||||||
flag.StringVar(&conf.Strategy.Check, "check", "http://www.msftconnecttest.com/connecttest.txt#expect=200", "check=tcp[://HOST:PORT]: tcp port connect check\ncheck=http://HOST[:PORT][/URI][#expect=REGEX_MATCH_IN_RESP_LINE]\ncheck=https://HOST[:PORT][/URI][#expect=REGEX_MATCH_IN_RESP_LINE]\ncheck=file://SCRIPT_PATH: run a check script, healthy when exitcode=0, environment variables: FORWARDER_ADDR,FORWARDER_URL\ncheck=disable: disable health check")
|
ha: High Availability mode
|
||||||
|
lha: Latency based High Availability mode
|
||||||
|
dh: Destination Hashing mode`)
|
||||||
|
flag.StringVar(&conf.Strategy.Check, "check", "http://www.msftconnecttest.com/connecttest.txt#expect=200",
|
||||||
|
`check=tcp[://HOST:PORT]: tcp port connect check
|
||||||
|
check=http://HOST[:PORT][/URI][#expect=REGEX_MATCH_IN_RESP_LINE]
|
||||||
|
check=https://HOST[:PORT][/URI][#expect=REGEX_MATCH_IN_RESP_LINE]
|
||||||
|
check=file://SCRIPT_PATH: run a check script, healthy when exitcode=0, env vars: FORWARDER_ADDR,FORWARDER_URL
|
||||||
|
check=disable: disable health check`)
|
||||||
flag.IntVar(&conf.Strategy.CheckInterval, "checkinterval", 30, "fowarder check interval(seconds)")
|
flag.IntVar(&conf.Strategy.CheckInterval, "checkinterval", 30, "fowarder check interval(seconds)")
|
||||||
flag.IntVar(&conf.Strategy.CheckTimeout, "checktimeout", 10, "fowarder check timeout(seconds)")
|
flag.IntVar(&conf.Strategy.CheckTimeout, "checktimeout", 10, "fowarder check timeout(seconds)")
|
||||||
flag.IntVar(&conf.Strategy.CheckTolerance, "checktolerance", 0, "fowarder check tolerance(ms), switch only when new_latency < old_latency - tolerance, only used in lha mode")
|
flag.IntVar(&conf.Strategy.CheckTolerance, "checktolerance", 0, "fowarder check tolerance(ms), switch only when new_latency < old_latency - tolerance, only used in lha mode")
|
||||||
@ -71,7 +81,7 @@ func parseConfig() *Config {
|
|||||||
flag.IntVar(&conf.DNSConfig.Timeout, "dnstimeout", 3, "timeout value used in multiple dnsservers switch(seconds)")
|
flag.IntVar(&conf.DNSConfig.Timeout, "dnstimeout", 3, "timeout value used in multiple dnsservers switch(seconds)")
|
||||||
flag.IntVar(&conf.DNSConfig.MaxTTL, "dnsmaxttl", 1800, "maximum TTL value for entries in the CACHE(seconds)")
|
flag.IntVar(&conf.DNSConfig.MaxTTL, "dnsmaxttl", 1800, "maximum TTL value for entries in the CACHE(seconds)")
|
||||||
flag.IntVar(&conf.DNSConfig.MinTTL, "dnsminttl", 0, "minimum TTL value for entries in the CACHE(seconds)")
|
flag.IntVar(&conf.DNSConfig.MinTTL, "dnsminttl", 0, "minimum TTL value for entries in the CACHE(seconds)")
|
||||||
flag.IntVar(&conf.DNSConfig.CacheSize, "dnscachesize", 4096, "size of CACHE")
|
flag.IntVar(&conf.DNSConfig.CacheSize, "dnscachesize", 4096, "max number of dns response in CACHE")
|
||||||
flag.BoolVar(&conf.DNSConfig.CacheLog, "dnscachelog", false, "show query log of dns cache")
|
flag.BoolVar(&conf.DNSConfig.CacheLog, "dnscachelog", false, "show query log of dns cache")
|
||||||
flag.BoolVar(&conf.DNSConfig.NoAAAA, "dnsnoaaaa", false, "disable AAAA query")
|
flag.BoolVar(&conf.DNSConfig.NoAAAA, "dnsnoaaaa", false, "disable AAAA query")
|
||||||
flag.StringSliceUniqVar(&conf.DNSConfig.Records, "dnsrecord", nil, "custom dns record, format: domain/ip")
|
flag.StringSliceUniqVar(&conf.DNSConfig.Records, "dnsrecord", nil, "custom dns record, format: domain/ip")
|
||||||
@ -87,6 +97,11 @@ func parseConfig() *Config {
|
|||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *scheme != "" {
|
||||||
|
fmt.Fprintf(os.Stdout, proxy.Usage(*scheme))
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
// setup logger
|
// setup logger
|
||||||
log.Set(conf.Verbose, conf.LogFlags)
|
log.Set(conf.Verbose, conf.LogFlags)
|
||||||
|
|
||||||
@ -139,212 +154,53 @@ func parseConfig() *Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func usage() {
|
func usage() {
|
||||||
app := os.Args[0]
|
|
||||||
w := flag.Output()
|
w := flag.Output()
|
||||||
|
|
||||||
fmt.Fprintf(w, "\n")
|
fmt.Fprint(w, `
|
||||||
fmt.Fprintf(w, "%s %s usage:\n", app, version)
|
Usage: glider [-listen URL]... [-forward URL]... [OPTION]...
|
||||||
|
e.g. glider -config /etc/glider/glider.conf
|
||||||
|
glider -listen :8443 -forward socks5://serverA:1080 -forward socks5://serverB:1080 -verbose
|
||||||
|
|
||||||
|
`)
|
||||||
|
|
||||||
|
fmt.Fprintf(w, "OPTION:\n")
|
||||||
flag.PrintDefaults()
|
flag.PrintDefaults()
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Available schemes:\n")
|
fmt.Fprint(w, `
|
||||||
fmt.Fprintf(w, " listen: mixed ss socks5 http vless trojan trojanc redir redir6 tproxy tcp udp tls ws wss unix smux kcp pxyproto\n")
|
URL:
|
||||||
fmt.Fprintf(w, " forward: direct reject ss socks4 socks5 http ssr ssh vless vmess trojan trojanc tcp udp tls ws wss unix smux kcp simple-obfs\n")
|
proxy: SCHEME://[USER:PASS@][HOST]:PORT
|
||||||
fmt.Fprintf(w, "\n")
|
chain: proxy,proxy,[proxy]...
|
||||||
|
|
||||||
fmt.Fprintf(w, "Socks5 scheme:\n")
|
e.g. -listen socks5://:1080
|
||||||
fmt.Fprintf(w, " socks://[user:pass@]host:port\n")
|
-listen tls://:443?cert=crtFilePath&key=keyFilePath,http:// (protocol chain)
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "SS scheme:\n")
|
e.g. -forward socks5://server:1080
|
||||||
fmt.Fprintf(w, " ss://method:pass@host:port\n")
|
-forward tls://server.com:443,http:// (protocol chain)
|
||||||
fmt.Fprintf(w, "\n")
|
-forward socks5://serverA:1080,socks5://serverB:1080 (proxy chain)
|
||||||
|
|
||||||
fmt.Fprintf(w, "Available methods for ss:\n")
|
`)
|
||||||
fmt.Fprintf(w, " AEAD Ciphers:\n")
|
|
||||||
fmt.Fprintf(w, " AEAD_AES_128_GCM AEAD_AES_192_GCM AEAD_AES_256_GCM AEAD_CHACHA20_POLY1305 AEAD_XCHACHA20_POLY1305\n")
|
|
||||||
fmt.Fprintf(w, " Stream Ciphers:\n")
|
|
||||||
fmt.Fprintf(w, " AES-128-CFB AES-128-CTR AES-192-CFB AES-192-CTR AES-256-CFB AES-256-CTR CHACHA20-IETF XCHACHA20 CHACHA20 RC4-MD5\n")
|
|
||||||
fmt.Fprintf(w, " Alias:\n")
|
|
||||||
fmt.Fprintf(w, " chacha20-ietf-poly1305 = AEAD_CHACHA20_POLY1305, xchacha20-ietf-poly1305 = AEAD_XCHACHA20_POLY1305\n")
|
|
||||||
fmt.Fprintf(w, " Plain: NONE\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "SSR scheme:\n")
|
fmt.Fprintf(w, "SCHEME:\n")
|
||||||
fmt.Fprintf(w, " ssr://method:pass@host:port?protocol=xxx&protocol_param=yyy&obfs=zzz&obfs_param=xyz\n")
|
fmt.Fprintf(w, " listen : %s\n", proxy.ServerSchemes())
|
||||||
fmt.Fprintf(w, "\n")
|
fmt.Fprintf(w, " forward: %s\n", proxy.DialerSchemes())
|
||||||
|
fmt.Fprintf(w, "\n Note: use `glider -scheme all` or `glider -scheme SCHEME` to see help info for the scheme.\n")
|
||||||
|
|
||||||
fmt.Fprintf(w, "SSH scheme:\n")
|
fmt.Fprint(w, `
|
||||||
fmt.Fprintf(w, " ssh://user[:pass]@host:port[?key=keypath&timeout=SECONDS]\n")
|
--
|
||||||
fmt.Fprintf(w, " timeout: timeout of ssh handshake and channel operation, default: 5\n")
|
Forwarder Options: FORWARD_URL#OPTIONS
|
||||||
fmt.Fprintf(w, "\n")
|
priority : the priority of that forwarder, the larger the higher, default: 0
|
||||||
|
interface: the local interface or ip address used to connect remote server.
|
||||||
|
|
||||||
fmt.Fprintf(w, "VMess scheme:\n")
|
e.g. -forward socks5://server:1080#priority=100
|
||||||
fmt.Fprintf(w, " vmess://[security:]uuid@host:port[?alterID=num]\n")
|
-forward socks5://server:1080#interface=eth0
|
||||||
fmt.Fprintf(w, " if alterID=0 or not set, VMessAEAD will be enabled\n")
|
-forward socks5://server:1080#priority=100&interface=192.168.1.99
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Available security for vmess:\n")
|
Services:
|
||||||
fmt.Fprintf(w, " zero, none, aes-128-gcm, chacha20-poly1305\n")
|
dhcpd: service=dhcpd,INTERFACE,START_IP,END_IP,LEASE_MINUTES[,MAC=IP,MAC=IP...]
|
||||||
fmt.Fprintf(w, "\n")
|
e.g. service=dhcpd,eth1,192.168.1.100,192.168.1.199,720
|
||||||
|
|
||||||
fmt.Fprintf(w, "VLESS scheme:\n")
|
see README.md and glider.conf.example for more details.
|
||||||
fmt.Fprintf(w, " vless://uuid@host:port[?fallback=127.0.0.1:80]\n")
|
`)
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Trojan client scheme:\n")
|
fmt.Fprintf(w, "--\nglider v%s, https://github.com/nadoo/glider\n\n", version)
|
||||||
fmt.Fprintf(w, " trojan://pass@host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH]\n")
|
|
||||||
fmt.Fprintf(w, " trojanc://pass@host:port (cleartext, without TLS)\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Trojan server scheme:\n")
|
|
||||||
fmt.Fprintf(w, " trojan://pass@host:port?cert=PATH&key=PATH[&fallback=127.0.0.1]\n")
|
|
||||||
fmt.Fprintf(w, " trojanc://pass@host:port[?fallback=127.0.0.1] (cleartext, without TLS)\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "TLS client scheme:\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&alpn=proto1][&alpn=proto2]\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Proxy over tls client:\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port[?skipVerify=true][&serverName=SERVERNAME],scheme://\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port[?skipVerify=true],http://[user:pass@]\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port[?skipVerify=true],socks5://[user:pass@]\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port[?skipVerify=true],vmess://[security:]uuid@?alterID=num\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "TLS server scheme:\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port?cert=PATH&key=PATH[&alpn=proto1][&alpn=proto2]\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Proxy over tls server:\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port?cert=PATH&key=PATH,scheme://\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port?cert=PATH&key=PATH,http://\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port?cert=PATH&key=PATH,socks5://\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port?cert=PATH&key=PATH,ss://method:pass@\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Websocket client scheme:\n")
|
|
||||||
fmt.Fprintf(w, " ws://host:port[/path][?host=HOST][&origin=ORIGIN]\n")
|
|
||||||
fmt.Fprintf(w, " wss://host:port[/path][?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&host=HOST][&origin=ORIGIN]\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Websocket server scheme:\n")
|
|
||||||
fmt.Fprintf(w, " ws://:port[/path][?host=HOST]\n")
|
|
||||||
fmt.Fprintf(w, " wss://:port[/path]?cert=PATH&key=PATH[?host=HOST]\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Websocket with a specified proxy protocol:\n")
|
|
||||||
fmt.Fprintf(w, " ws://host:port[/path][?host=HOST],scheme://\n")
|
|
||||||
fmt.Fprintf(w, " ws://host:port[/path][?host=HOST],http://[user:pass@]\n")
|
|
||||||
fmt.Fprintf(w, " ws://host:port[/path][?host=HOST],socks5://[user:pass@]\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "TLS and Websocket with a specified proxy protocol:\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port[?skipVerify=true][&serverName=SERVERNAME],ws://[@/path[?host=HOST]],scheme://\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],http://[user:pass@]\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],socks5://[user:pass@]\n")
|
|
||||||
fmt.Fprintf(w, " tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],vmess://[security:]uuid@?alterID=num\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Unix domain socket scheme:\n")
|
|
||||||
fmt.Fprintf(w, " unix://path\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Smux scheme:\n")
|
|
||||||
fmt.Fprintf(w, " smux://host:port\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "KCP scheme:\n")
|
|
||||||
fmt.Fprintf(w, " kcp://CRYPT:KEY@host:port[?dataShards=NUM&parityShards=NUM&mode=MODE]\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Available crypt types for KCP:\n")
|
|
||||||
fmt.Fprintf(w, " none, sm4, tea, xor, aes, aes-128, aes-192, blowfish, twofish, cast5, 3des, xtea, salsa20\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Available modes for KCP:\n")
|
|
||||||
fmt.Fprintf(w, " fast, fast2, fast3, normal, default: fast\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Simple-Obfs scheme:\n")
|
|
||||||
fmt.Fprintf(w, " simple-obfs://host:port[?type=TYPE&host=HOST&uri=URI&ua=UA]\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Available types for simple-obfs:\n")
|
|
||||||
fmt.Fprintf(w, " http, tls\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "DNS forwarding server:\n")
|
|
||||||
fmt.Fprintf(w, " dns=:53\n")
|
|
||||||
fmt.Fprintf(w, " dnsserver=8.8.8.8:53\n")
|
|
||||||
fmt.Fprintf(w, " dnsserver=1.1.1.1:53\n")
|
|
||||||
fmt.Fprintf(w, " dnsrecord=www.example.com/1.2.3.4\n")
|
|
||||||
fmt.Fprintf(w, " dnsrecord=www.example.com/2606:2800:220:1:248:1893:25c8:1946\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Available forward strategies:\n")
|
|
||||||
fmt.Fprintf(w, " rr: Round Robin mode\n")
|
|
||||||
fmt.Fprintf(w, " ha: High Availability mode\n")
|
|
||||||
fmt.Fprintf(w, " lha: Latency based High Availability mode\n")
|
|
||||||
fmt.Fprintf(w, " dh: Destination Hashing mode\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Forwarder option scheme: FORWARD_URL#OPTIONS\n")
|
|
||||||
fmt.Fprintf(w, " priority: set the priority of that forwarder, default:0\n")
|
|
||||||
fmt.Fprintf(w, " interface: set local interface or ip address used to connect remote server\n")
|
|
||||||
fmt.Fprintf(w, " -\n")
|
|
||||||
fmt.Fprintf(w, " Examples:\n")
|
|
||||||
fmt.Fprintf(w, " socks5://1.1.1.1:1080#priority=100\n")
|
|
||||||
fmt.Fprintf(w, " vmess://[security:]uuid@host:port?alterID=num#priority=200\n")
|
|
||||||
fmt.Fprintf(w, " vmess://[security:]uuid@host:port?alterID=num#priority=200&interface=192.168.1.99\n")
|
|
||||||
fmt.Fprintf(w, " vmess://[security:]uuid@host:port?alterID=num#priority=200&interface=eth0\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Services:\n")
|
|
||||||
fmt.Fprintf(w, " dhcpd: service=dhcpd,INTERFACE,START_IP,END_IP,LEASE_MINUTES[,MAC=IP,MAC=IP...]\n")
|
|
||||||
fmt.Fprintf(w, " e.g.,service=dhcpd,eth1,192.168.1.100,192.168.1.199,720\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Config file format(see `"+app+".conf.example` as an example):\n")
|
|
||||||
fmt.Fprintf(w, " # COMMENT LINE\n")
|
|
||||||
fmt.Fprintf(w, " KEY=VALUE\n")
|
|
||||||
fmt.Fprintf(w, " KEY=VALUE\n")
|
|
||||||
fmt.Fprintf(w, " # KEY equals to command line flag name: listen forward strategy...\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
|
|
||||||
fmt.Fprintf(w, "Examples:\n")
|
|
||||||
fmt.Fprintf(w, " "+app+" -config glider.conf\n")
|
|
||||||
fmt.Fprintf(w, " -run glider with specified config file.\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
fmt.Fprintf(w, " "+app+" -listen :8443 -verbose\n")
|
|
||||||
fmt.Fprintf(w, " -listen on :8443, serve as http/socks5 proxy on the same port, in verbose mode.\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
fmt.Fprintf(w, " "+app+" -listen ss://AEAD_AES_128_GCM:pass@:8443 -verbose\n")
|
|
||||||
fmt.Fprintf(w, " -listen on 0.0.0.0:8443 as a ss server.\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
fmt.Fprintf(w, " "+app+" -listen tls://:443?cert=crtFilePath&key=keyFilePath,http:// -verbose\n")
|
|
||||||
fmt.Fprintf(w, " -listen on :443 as a https(http over tls) proxy server.\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
fmt.Fprintf(w, " "+app+" -listen http://:8080 -forward socks5://127.0.0.1:1080\n")
|
|
||||||
fmt.Fprintf(w, " -listen on :8080 as a http proxy server, forward all requests via socks5 server.\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
fmt.Fprintf(w, " "+app+" -listen socks5://:1080 -forward \"tls://abc.com:443,vmess://security:uuid@?alterID=10\"\n")
|
|
||||||
fmt.Fprintf(w, " -listen on :1080 as a socks5 server, forward all requests via remote tls+vmess server.\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
fmt.Fprintf(w, " "+app+" -listen socks5://:1080 -forward ss://method:pass@server1:port1 -forward ss://method:pass@server2:port2 -strategy rr\n")
|
|
||||||
fmt.Fprintf(w, " -listen on :1080 as socks5 server, forward requests via server1 and server2 in round robin mode.\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
fmt.Fprintf(w, " "+app+" -listen tcp://:80 -forward tcp://2.2.2.2:80\n")
|
|
||||||
fmt.Fprintf(w, " -tcp tunnel: listen on :80 and forward all requests to 2.2.2.2:80.\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
fmt.Fprintf(w, " "+app+" -listen udp://:53 -forward ss://method:pass@1.1.1.1:8443,udp://8.8.8.8:53\n")
|
|
||||||
fmt.Fprintf(w, " -listen on :53 and forward all udp requests to 8.8.8.8:53 via remote ss server.\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
fmt.Fprintf(w, " "+app+" -listen socks5://:1080 -listen http://:8080 -forward ss://method:pass@1.1.1.1:8443\n")
|
|
||||||
fmt.Fprintf(w, " -listen on :1080 as socks5 server, :8080 as http proxy server, forward all requests via remote ss server.\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
fmt.Fprintf(w, " "+app+" -verbose -listen -dns=:53 -dnsserver=8.8.8.8:53 -forward ss://method:pass@server:port -dnsrecord=www.example.com/1.2.3.4\n")
|
|
||||||
fmt.Fprintf(w, " -listen on :53 as dns server, forward to 8.8.8.8:53 via ss server.\n")
|
|
||||||
fmt.Fprintf(w, "\n")
|
|
||||||
}
|
}
|
||||||
|
4
go.mod
4
go.mod
@ -9,9 +9,9 @@ require (
|
|||||||
github.com/dgryski/go-rc2 v0.0.0-20150621095337-8a9021637152
|
github.com/dgryski/go-rc2 v0.0.0-20150621095337-8a9021637152
|
||||||
github.com/insomniacslk/dhcp v0.0.0-20220119180841-3c283ff8b7dd
|
github.com/insomniacslk/dhcp v0.0.0-20220119180841-3c283ff8b7dd
|
||||||
github.com/nadoo/conflag v0.3.1
|
github.com/nadoo/conflag v0.3.1
|
||||||
github.com/nadoo/ipset v0.4.1-0.20220202154244-ddbfbad6db35
|
github.com/nadoo/ipset v0.4.1-0.20220214103201-761217ee1ee0
|
||||||
github.com/xtaci/kcp-go/v5 v5.6.1
|
github.com/xtaci/kcp-go/v5 v5.6.1
|
||||||
golang.org/x/crypto v0.0.0-20220213190939-1e6e3497d506
|
golang.org/x/crypto v0.0.0-20220214200702-86341886e292
|
||||||
golang.org/x/sys v0.0.0-20220209214540-3681064d5158
|
golang.org/x/sys v0.0.0-20220209214540-3681064d5158
|
||||||
)
|
)
|
||||||
|
|
||||||
|
8
go.sum
8
go.sum
@ -67,8 +67,8 @@ github.com/mdlayher/raw v0.0.0-20211126142749-4eae47f3d54b/go.mod h1:7EpbotpCmVZ
|
|||||||
github.com/mmcloughlin/avo v0.0.0-20200803215136-443f81d77104/go.mod h1:wqKykBG2QzQDJEzvRkcS8x6MiSJkF52hXZsXcjaB3ls=
|
github.com/mmcloughlin/avo v0.0.0-20200803215136-443f81d77104/go.mod h1:wqKykBG2QzQDJEzvRkcS8x6MiSJkF52hXZsXcjaB3ls=
|
||||||
github.com/nadoo/conflag v0.3.1 h1:4pHkLIz8PUsfg6ajNYRRSY3bt6m2LPsu6KOzn5uIXQw=
|
github.com/nadoo/conflag v0.3.1 h1:4pHkLIz8PUsfg6ajNYRRSY3bt6m2LPsu6KOzn5uIXQw=
|
||||||
github.com/nadoo/conflag v0.3.1/go.mod h1:dzFfDUpXdr2uS2oV+udpy5N2vfNOu/bFzjhX1WI52co=
|
github.com/nadoo/conflag v0.3.1/go.mod h1:dzFfDUpXdr2uS2oV+udpy5N2vfNOu/bFzjhX1WI52co=
|
||||||
github.com/nadoo/ipset v0.4.1-0.20220202154244-ddbfbad6db35 h1:ROGpIZqxtrO0mJhSS9bte1VNwVUmmavcjjtw3720t94=
|
github.com/nadoo/ipset v0.4.1-0.20220214103201-761217ee1ee0 h1:i81BROp7xvMIkR1KpLwERTrRVgwwFAN0prz1kQmz9RE=
|
||||||
github.com/nadoo/ipset v0.4.1-0.20220202154244-ddbfbad6db35/go.mod h1:rYF5DQLRGGoQ8ZSWeK+6eX5amAuPqwFkWjhQlEITGJQ=
|
github.com/nadoo/ipset v0.4.1-0.20220214103201-761217ee1ee0/go.mod h1:rYF5DQLRGGoQ8ZSWeK+6eX5amAuPqwFkWjhQlEITGJQ=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
@ -104,8 +104,8 @@ golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPh
|
|||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20220213190939-1e6e3497d506 h1:EuGTJDfeg/PGZJp3gq1K+14eSLFTsrj1eg8KQuiUyKg=
|
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE=
|
||||||
golang.org/x/crypto v0.0.0-20220213190939-1e6e3497d506/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
|
@ -66,3 +66,12 @@ func DialerFromURL(s string, dialer Dialer) (Dialer, error) {
|
|||||||
|
|
||||||
return nil, errors.New("unknown scheme '" + scheme + "'")
|
return nil, errors.New("unknown scheme '" + scheme + "'")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DialerSchemes returns the registered dialer schemes.
|
||||||
|
func DialerSchemes() string {
|
||||||
|
s := make([]string, 0, len(dialerCreators))
|
||||||
|
for name := range dialerCreators {
|
||||||
|
s = append(s, name)
|
||||||
|
}
|
||||||
|
return strings.Join(s, ",")
|
||||||
|
}
|
||||||
|
@ -266,3 +266,16 @@ func (s *KCP) setParams(c *kcp.UDPSession) {
|
|||||||
c.SetMtu(1350)
|
c.SetMtu(1350)
|
||||||
c.SetACKNoDelay(true)
|
c.SetACKNoDelay(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("kcp", `
|
||||||
|
KCP scheme:
|
||||||
|
kcp://CRYPT:KEY@host:port[?dataShards=NUM&parityShards=NUM&mode=MODE]
|
||||||
|
|
||||||
|
Available crypt types for KCP:
|
||||||
|
none, sm4, tea, xor, aes, aes-128, aes-192, blowfish, twofish, cast5, 3des, xtea, salsa20
|
||||||
|
|
||||||
|
Available modes for KCP:
|
||||||
|
fast, fast2, fast3, normal, default: fast
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
@ -109,3 +109,13 @@ func (s *Obfs) Dial(network, addr string) (net.Conn, error) {
|
|||||||
func (s *Obfs) DialUDP(network, addr string) (net.PacketConn, net.Addr, error) {
|
func (s *Obfs) DialUDP(network, addr string) (net.PacketConn, net.Addr, error) {
|
||||||
return nil, nil, proxy.ErrNotSupported
|
return nil, nil, proxy.ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("simple-obfs", `
|
||||||
|
Simple-Obfs scheme:
|
||||||
|
simple-obfs://host:port[?type=TYPE&host=HOST&uri=URI&ua=UA]
|
||||||
|
|
||||||
|
Available types for simple-obfs:
|
||||||
|
http, tls
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
@ -51,3 +51,12 @@ func ServerFromURL(s string, proxy Proxy) (Server, error) {
|
|||||||
|
|
||||||
return nil, errors.New("unknown scheme '" + scheme + "'")
|
return nil, errors.New("unknown scheme '" + scheme + "'")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ServerSchemes returns the registered server schemes.
|
||||||
|
func ServerSchemes() string {
|
||||||
|
s := make([]string, 0, len(serverCreators))
|
||||||
|
for name := range serverCreators {
|
||||||
|
s = append(s, name)
|
||||||
|
}
|
||||||
|
return strings.Join(s, ",")
|
||||||
|
}
|
||||||
|
10
proxy/smux/smux.go
Normal file
10
proxy/smux/smux.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package smux
|
||||||
|
|
||||||
|
import "github.com/nadoo/glider/proxy"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("smux", `
|
||||||
|
Smux scheme:
|
||||||
|
smux://host:port
|
||||||
|
`)
|
||||||
|
}
|
@ -13,6 +13,10 @@ import (
|
|||||||
"github.com/nadoo/glider/proxy"
|
"github.com/nadoo/glider/proxy"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.RegisterDialer("socks5", NewSocks5Dialer)
|
||||||
|
}
|
||||||
|
|
||||||
// NewSocks5Dialer returns a socks5 proxy dialer.
|
// NewSocks5Dialer returns a socks5 proxy dialer.
|
||||||
func NewSocks5Dialer(s string, d proxy.Dialer) (proxy.Dialer, error) {
|
func NewSocks5Dialer(s string, d proxy.Dialer) (proxy.Dialer, error) {
|
||||||
return NewSocks5(s, d, nil)
|
return NewSocks5(s, d, nil)
|
||||||
|
@ -16,6 +16,10 @@ import (
|
|||||||
|
|
||||||
var nm sync.Map
|
var nm sync.Map
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.RegisterServer("socks5", NewSocks5Server)
|
||||||
|
}
|
||||||
|
|
||||||
// NewSocks5Server returns a socks5 proxy server.
|
// NewSocks5Server returns a socks5 proxy server.
|
||||||
func NewSocks5Server(s string, p proxy.Proxy) (proxy.Server, error) {
|
func NewSocks5Server(s string, p proxy.Proxy) (proxy.Server, error) {
|
||||||
return NewSocks5(s, nil, p)
|
return NewSocks5(s, nil, p)
|
||||||
|
@ -28,11 +28,6 @@ type Socks5 struct {
|
|||||||
password string
|
password string
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
|
||||||
proxy.RegisterDialer("socks5", NewSocks5Dialer)
|
|
||||||
proxy.RegisterServer("socks5", NewSocks5Server)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewSocks5 returns a Proxy that makes SOCKS v5 connections to the given address.
|
// NewSocks5 returns a Proxy that makes SOCKS v5 connections to the given address.
|
||||||
// with an optional username and password. (RFC 1928)
|
// with an optional username and password. (RFC 1928)
|
||||||
func NewSocks5(s string, d proxy.Dialer, p proxy.Proxy) (*Socks5, error) {
|
func NewSocks5(s string, d proxy.Dialer, p proxy.Proxy) (*Socks5, error) {
|
||||||
@ -56,3 +51,10 @@ func NewSocks5(s string, d proxy.Dialer, p proxy.Proxy) (*Socks5, error) {
|
|||||||
|
|
||||||
return h, nil
|
return h, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("socks5", `
|
||||||
|
Socks5 scheme:
|
||||||
|
socks://[user:pass@]host:port
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
@ -48,3 +48,19 @@ func NewSS(s string, d proxy.Dialer, p proxy.Proxy) (*SS, error) {
|
|||||||
|
|
||||||
return ss, nil
|
return ss, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("ss", `
|
||||||
|
SS scheme:
|
||||||
|
ss://method:pass@host:port
|
||||||
|
|
||||||
|
Available methods for ss:
|
||||||
|
AEAD Ciphers:
|
||||||
|
AEAD_AES_128_GCM AEAD_AES_192_GCM AEAD_AES_256_GCM AEAD_CHACHA20_POLY1305 AEAD_XCHACHA20_POLY1305
|
||||||
|
Stream Ciphers:
|
||||||
|
AES-128-CFB AES-128-CTR AES-192-CFB AES-192-CTR AES-256-CFB AES-256-CTR CHACHA20-IETF XCHACHA20 CHACHA20 RC4-MD5
|
||||||
|
Alias:
|
||||||
|
chacha20-ietf-poly1305 = AEAD_CHACHA20_POLY1305, xchacha20-ietf-poly1305 = AEAD_XCHACHA20_POLY1305
|
||||||
|
Plain: NONE
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
@ -166,3 +166,11 @@ func privateKeyAuth(file string) (ssh.AuthMethod, error) {
|
|||||||
|
|
||||||
return ssh.PublicKeys(key), nil
|
return ssh.PublicKeys(key), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("ssh", `
|
||||||
|
SSH scheme:
|
||||||
|
ssh://user[:pass]@host:port[?key=keypath&timeout=SECONDS]
|
||||||
|
timeout: timeout of ssh handshake and channel operation, default: 5
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
@ -155,3 +155,10 @@ func (s *SSR) Dial(network, addr string) (net.Conn, error) {
|
|||||||
func (s *SSR) DialUDP(network, addr string) (net.PacketConn, net.Addr, error) {
|
func (s *SSR) DialUDP(network, addr string) (net.PacketConn, net.Addr, error) {
|
||||||
return nil, nil, proxy.ErrNotSupported
|
return nil, nil, proxy.ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("ssr", `
|
||||||
|
SSR scheme:
|
||||||
|
ssr://method:pass@host:port?protocol=xxx&protocol_param=yyy&obfs=zzz&obfs_param=xyz
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
@ -210,3 +210,25 @@ func (s *TLS) Dial(network, addr string) (net.Conn, error) {
|
|||||||
func (s *TLS) DialUDP(network, addr string) (net.PacketConn, net.Addr, error) {
|
func (s *TLS) DialUDP(network, addr string) (net.PacketConn, net.Addr, error) {
|
||||||
return nil, nil, proxy.ErrNotSupported
|
return nil, nil, proxy.ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("tls", `
|
||||||
|
TLS client scheme:
|
||||||
|
tls://host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&alpn=proto1][&alpn=proto2]
|
||||||
|
|
||||||
|
Proxy over tls client:
|
||||||
|
tls://host:port[?skipVerify=true][&serverName=SERVERNAME],scheme://
|
||||||
|
tls://host:port[?skipVerify=true],http://[user:pass@]
|
||||||
|
tls://host:port[?skipVerify=true],socks5://[user:pass@]
|
||||||
|
tls://host:port[?skipVerify=true],vmess://[security:]uuid@?alterID=num
|
||||||
|
|
||||||
|
TLS server scheme:
|
||||||
|
tls://host:port?cert=PATH&key=PATH[&alpn=proto1][&alpn=proto2]
|
||||||
|
|
||||||
|
Proxy over tls server:
|
||||||
|
tls://host:port?cert=PATH&key=PATH,scheme://
|
||||||
|
tls://host:port?cert=PATH&key=PATH,http://
|
||||||
|
tls://host:port?cert=PATH&key=PATH,socks5://
|
||||||
|
tls://host:port?cert=PATH&key=PATH,ss://method:pass@
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
@ -71,3 +71,15 @@ func NewTrojan(s string, d proxy.Dialer, p proxy.Proxy) (*Trojan, error) {
|
|||||||
|
|
||||||
return t, nil
|
return t, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("trojan", `
|
||||||
|
Trojan client scheme:
|
||||||
|
trojan://pass@host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH]
|
||||||
|
trojanc://pass@host:port (cleartext, without TLS)
|
||||||
|
|
||||||
|
Trojan server scheme:
|
||||||
|
trojan://pass@host:port?cert=PATH&key=PATH[&fallback=127.0.0.1]
|
||||||
|
trojanc://pass@host:port[?fallback=127.0.0.1] (cleartext, without TLS)
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
@ -48,3 +48,10 @@ func NewUnix(s string, d proxy.Dialer, p proxy.Proxy) (*Unix, error) {
|
|||||||
|
|
||||||
return unix, nil
|
return unix, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("unix", `
|
||||||
|
Unix domain socket scheme:
|
||||||
|
unix://path
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
24
proxy/usage.go
Normal file
24
proxy/usage.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package proxy
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
|
var msg strings.Builder
|
||||||
|
var usages = make(map[string]string)
|
||||||
|
|
||||||
|
// AddUsage adds help message for the named proxy.
|
||||||
|
func AddUsage(name, usage string) {
|
||||||
|
usages[name] = usage
|
||||||
|
msg.WriteString(usage)
|
||||||
|
msg.WriteString("\n--")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usage returns help message of the named proxy.
|
||||||
|
func Usage(name string) string {
|
||||||
|
if name == "all" {
|
||||||
|
return msg.String()
|
||||||
|
}
|
||||||
|
if usage, ok := usages[name]; ok {
|
||||||
|
return usage
|
||||||
|
}
|
||||||
|
return "can not find usage for: " + name
|
||||||
|
}
|
@ -81,3 +81,10 @@ func StrToUUID(s string) (uuid [16]byte, err error) {
|
|||||||
_, err = hex.Decode(uuid[:], b)
|
_, err = hex.Decode(uuid[:], b)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("vless", `
|
||||||
|
VLESS scheme:
|
||||||
|
vless://uuid@host:port[?fallback=127.0.0.1:80]
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
@ -109,3 +109,14 @@ func (s *VMess) DialUDP(network, addr string) (net.PacketConn, net.Addr, error)
|
|||||||
}
|
}
|
||||||
return NewPktConn(rc), nil, err
|
return NewPktConn(rc), nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("vmess", `
|
||||||
|
VMess scheme:
|
||||||
|
vmess://[security:]uuid@host:port[?alterID=num]
|
||||||
|
if alterID=0 or not set, VMessAEAD will be enabled
|
||||||
|
|
||||||
|
Available security for vmess:
|
||||||
|
zero, none, aes-128-gcm, chacha20-poly1305
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
@ -115,3 +115,26 @@ func computeServerKey(clientKey string) string {
|
|||||||
h.Write(keyGUID)
|
h.Write(keyGUID)
|
||||||
return base64.StdEncoding.EncodeToString(h.Sum(nil))
|
return base64.StdEncoding.EncodeToString(h.Sum(nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proxy.AddUsage("ws", `
|
||||||
|
Websocket client scheme:
|
||||||
|
ws://host:port[/path][?host=HOST][&origin=ORIGIN]
|
||||||
|
wss://host:port[/path][?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&host=HOST][&origin=ORIGIN]
|
||||||
|
|
||||||
|
Websocket server scheme:
|
||||||
|
ws://:port[/path][?host=HOST]
|
||||||
|
wss://:port[/path]?cert=PATH&key=PATH[?host=HOST]
|
||||||
|
|
||||||
|
Websocket with a specified proxy protocol:
|
||||||
|
ws://host:port[/path][?host=HOST],scheme://
|
||||||
|
ws://host:port[/path][?host=HOST],http://[user:pass@]
|
||||||
|
ws://host:port[/path][?host=HOST],socks5://[user:pass@]
|
||||||
|
|
||||||
|
TLS and Websocket with a specified proxy protocol:
|
||||||
|
tls://host:port[?skipVerify=true][&serverName=SERVERNAME],ws://[@/path[?host=HOST]],scheme://
|
||||||
|
tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],http://[user:pass@]
|
||||||
|
tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],socks5://[user:pass@]
|
||||||
|
tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],vmess://[security:]uuid@?alterID=num
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user