2017-07-30 12:38:41 +08:00
|
|
|
# [glider](https://github.com/nadoo/glider)
|
2017-09-10 19:48:53 +08:00
|
|
|
|
2022-05-03 18:19:33 +08:00
|
|
|
[](https://go.dev/dl/)
|
2020-04-11 21:08:10 +08:00
|
|
|
[](https://goreportcard.com/report/github.com/nadoo/glider)
|
|
|
|
[](https://github.com/nadoo/glider/releases)
|
2023-11-28 18:26:33 +08:00
|
|
|
[](https://github.com/nadoo/glider/actions)
|
2022-05-03 18:19:33 +08:00
|
|
|
[](https://hub.docker.com/r/nadoo/glider)
|
2017-09-10 19:48:53 +08:00
|
|
|
|
2020-10-03 22:42:34 +08:00
|
|
|
glider is a forward proxy with multiple protocols support, and also a dns/dhcp server with ipset management features(like dnsmasq).
|
2017-07-13 21:55:41 +08:00
|
|
|
|
2017-09-03 01:05:56 +08:00
|
|
|
we can set up local listeners as proxy servers, and forward requests to internet via forwarders.
|
2018-08-01 00:47:43 +08:00
|
|
|
|
|
|
|
```bash
|
|
|
|
|Forwarder ----------------->|
|
2017-07-23 01:57:05 +08:00
|
|
|
Listener --> | | Internet
|
2018-08-01 00:47:43 +08:00
|
|
|
|Forwarder --> Forwarder->...|
|
2017-07-23 01:57:05 +08:00
|
|
|
```
|
|
|
|
|
2017-07-27 01:22:56 +08:00
|
|
|
## Features
|
2020-04-14 00:17:46 +08:00
|
|
|
- Act as both proxy client and proxy server(protocol converter)
|
2020-04-12 17:24:34 +08:00
|
|
|
- Flexible proxy & protocol chains
|
2020-04-13 00:55:11 +08:00
|
|
|
- Load balancing with the following scheduling algorithm:
|
2020-04-12 17:24:34 +08:00
|
|
|
- rr: round robin
|
|
|
|
- ha: high availability
|
|
|
|
- lha: latency based high availability
|
|
|
|
- dh: destination hashing
|
|
|
|
- Rule & priority based forwarder choosing: [Config Examples](config/examples)
|
2020-04-19 17:03:39 +08:00
|
|
|
- DNS forwarding server:
|
|
|
|
- dns over proxy
|
|
|
|
- force upstream querying by tcp
|
|
|
|
- association rules between dns and forwarder choosing
|
|
|
|
- association rules between dns and ipset
|
|
|
|
- dns cache support
|
|
|
|
- custom dns record
|
|
|
|
- IPSet management (linux kernel version >= 2.6.32):
|
|
|
|
- add ip/cidrs from rule files on startup
|
|
|
|
- add resolved ips for domains from rule files by dns forwarding server
|
2020-04-12 17:24:34 +08:00
|
|
|
- Serve http and socks5 on the same port
|
|
|
|
- Periodical availability checking for forwarders
|
|
|
|
- Send requests from specific local ip/interface
|
2020-10-01 19:29:53 +08:00
|
|
|
- Services:
|
2022-02-23 22:20:06 +08:00
|
|
|
- dhcpd: a simple dhcp server that can run in failover mode
|
2017-07-30 10:57:24 +08:00
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
## Protocols
|
2020-12-04 18:42:16 +08:00
|
|
|
|
2020-04-14 00:17:46 +08:00
|
|
|
<details>
|
|
|
|
<summary>click to see details</summary>
|
2020-12-04 18:42:16 +08:00
|
|
|
|
2021-08-05 23:52:31 +08:00
|
|
|
|Protocol | Listen/TCP | Listen/UDP | Forward/TCP | Forward/UDP | Description
|
|
|
|
|:-: |:-:|:-:|:-:|:-:|:-
|
|
|
|
|Mixed |√|√| | |http+socks5 server
|
|
|
|
|HTTP |√| |√| |client & server
|
|
|
|
|SOCKS5 |√|√|√|√|client & server
|
|
|
|
|SS |√|√|√|√|client & server
|
|
|
|
|Trojan |√|√|√|√|client & server
|
|
|
|
|Trojanc |√|√|√|√|trojan cleartext(without tls)
|
|
|
|
|VLESS |√|√|√|√|client & server
|
|
|
|
|VMess | | |√|√|client only
|
|
|
|
|SSR | | |√| |client only
|
|
|
|
|SSH | | |√| |client only
|
|
|
|
|SOCKS4 | | |√| |client only
|
|
|
|
|SOCKS4A | | |√| |client only
|
|
|
|
|TCP |√| |√| |tcp tunnel client & server
|
|
|
|
|UDP | |√| |√|udp tunnel client & server
|
|
|
|
|TLS |√| |√| |transport client & server
|
|
|
|
|KCP | |√|√| |transport client & server
|
|
|
|
|Unix |√|√|√|√|transport client & server
|
2022-04-06 18:47:04 +08:00
|
|
|
|VSOCK |√| |√| |transport client & server
|
2021-08-05 23:52:31 +08:00
|
|
|
|Smux |√| |√| |transport client & server
|
|
|
|
|Websocket(WS) |√| |√| |transport client & server
|
|
|
|
|WS Secure |√| |√| |websocket secure (wss)
|
|
|
|
|Proxy Protocol |√| | | |version 1 server only
|
|
|
|
|Simple-Obfs | | |√| |transport client only
|
|
|
|
|Redir |√| | | |linux redirect proxy
|
|
|
|
|Redir6 |√| | | |linux redirect proxy(ipv6)
|
2022-05-03 18:19:33 +08:00
|
|
|
|TProxy | |√| | |linux tproxy(udp only)
|
2021-08-05 23:52:31 +08:00
|
|
|
|Reject | | |√|√|reject all requests
|
2020-04-14 00:17:46 +08:00
|
|
|
|
|
|
|
</details>
|
2020-04-12 15:27:20 +08:00
|
|
|
|
2017-07-13 21:55:41 +08:00
|
|
|
## Install
|
2018-08-01 00:47:43 +08:00
|
|
|
|
2022-02-16 00:25:14 +08:00
|
|
|
- Binary: [https://github.com/nadoo/glider/releases](https://github.com/nadoo/glider/releases)
|
|
|
|
- Docker: `docker pull nadoo/glider`
|
2023-11-28 18:26:33 +08:00
|
|
|
- Manjaro: `pamac install glider`
|
2022-02-16 00:25:14 +08:00
|
|
|
- ArchLinux: `sudo pacman -S glider`
|
2022-06-02 09:59:51 +08:00
|
|
|
- Homebrew: `brew install glider`
|
|
|
|
- MacPorts: `sudo port install glider`
|
2022-04-24 09:59:12 +08:00
|
|
|
- Source: `go install github.com/nadoo/glider@latest`
|
2017-07-21 18:58:51 +08:00
|
|
|
|
2022-02-20 01:07:51 +08:00
|
|
|
## Usage
|
|
|
|
|
2022-02-23 22:20:06 +08:00
|
|
|
#### Run
|
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
```bash
|
2022-05-03 18:19:33 +08:00
|
|
|
glider -verbose -listen :8443
|
2022-04-24 09:59:12 +08:00
|
|
|
# docker run --rm -it nadoo/glider -verbose -listen :8443
|
2022-02-16 23:37:25 +08:00
|
|
|
```
|
|
|
|
|
2022-02-23 17:48:43 +08:00
|
|
|
#### Help
|
2022-02-16 00:25:14 +08:00
|
|
|
|
2020-04-12 17:24:34 +08:00
|
|
|
<details>
|
2022-03-06 12:58:20 +08:00
|
|
|
<summary><code>glider -help</code></summary>
|
2020-04-12 17:24:34 +08:00
|
|
|
|
|
|
|
```bash
|
2022-02-15 21:34:55 +08:00
|
|
|
Usage: glider [-listen URL]... [-forward URL]... [OPTION]...
|
2022-02-16 00:25:14 +08:00
|
|
|
|
2022-02-15 21:34:55 +08:00
|
|
|
e.g. glider -config /etc/glider/glider.conf
|
|
|
|
glider -listen :8443 -forward socks5://serverA:1080 -forward socks5://serverB:1080 -verbose
|
|
|
|
|
|
|
|
OPTION:
|
2020-11-29 15:09:44 +08:00
|
|
|
-check string
|
2022-02-16 00:25:14 +08:00
|
|
|
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 (default "http://www.msftconnecttest.com/connecttest.txt#expect=200")
|
2020-04-29 18:45:58 +08:00
|
|
|
-checkdisabledonly
|
2022-02-16 00:25:14 +08:00
|
|
|
check disabled fowarders only
|
2020-04-12 17:24:34 +08:00
|
|
|
-checkinterval int
|
2022-02-16 00:25:14 +08:00
|
|
|
fowarder check interval(seconds) (default 30)
|
2022-02-20 21:37:36 +08:00
|
|
|
-checklatencysamples int
|
|
|
|
use the average latency of the latest N checks (default 10)
|
2020-04-12 17:24:34 +08:00
|
|
|
-checktimeout int
|
2022-02-16 00:25:14 +08:00
|
|
|
fowarder check timeout(seconds) (default 10)
|
2020-10-12 19:07:54 +08:00
|
|
|
-checktolerance int
|
2022-02-16 00:25:14 +08:00
|
|
|
fowarder check tolerance(ms), switch only when new_latency < old_latency - tolerance, only used in lha mode
|
2020-04-12 17:24:34 +08:00
|
|
|
-config string
|
2022-02-16 00:25:14 +08:00
|
|
|
config file path
|
2020-05-04 16:51:41 +08:00
|
|
|
-dialtimeout int
|
2022-02-16 00:25:14 +08:00
|
|
|
dial timeout(seconds) (default 3)
|
2020-04-12 17:24:34 +08:00
|
|
|
-dns string
|
2022-02-16 00:25:14 +08:00
|
|
|
local dns server listen address
|
2020-04-12 17:24:34 +08:00
|
|
|
-dnsalwaystcp
|
2022-02-16 00:25:14 +08:00
|
|
|
always use tcp to query upstream dns servers no matter there is a forwarder or not
|
2021-05-30 12:18:05 +08:00
|
|
|
-dnscachelog
|
2022-02-16 00:25:14 +08:00
|
|
|
show query log of dns cache
|
2020-10-08 18:48:23 +08:00
|
|
|
-dnscachesize int
|
2022-02-16 00:25:14 +08:00
|
|
|
max number of dns response in CACHE (default 4096)
|
2020-04-12 17:24:34 +08:00
|
|
|
-dnsmaxttl int
|
2022-02-16 00:25:14 +08:00
|
|
|
maximum TTL value for entries in the CACHE(seconds) (default 1800)
|
2020-04-12 17:24:34 +08:00
|
|
|
-dnsminttl int
|
2022-02-16 00:25:14 +08:00
|
|
|
minimum TTL value for entries in the CACHE(seconds)
|
2022-01-26 22:31:56 +08:00
|
|
|
-dnsnoaaaa
|
2022-02-16 00:25:14 +08:00
|
|
|
disable AAAA query
|
2020-04-12 17:24:34 +08:00
|
|
|
-dnsrecord value
|
2022-02-16 00:25:14 +08:00
|
|
|
custom dns record, format: domain/ip
|
2020-04-12 17:24:34 +08:00
|
|
|
-dnsserver value
|
2022-02-16 00:25:14 +08:00
|
|
|
remote dns server address
|
2020-04-12 17:24:34 +08:00
|
|
|
-dnstimeout int
|
2022-02-16 00:25:14 +08:00
|
|
|
timeout value used in multiple dnsservers switch(seconds) (default 3)
|
2022-02-16 23:37:25 +08:00
|
|
|
-example
|
|
|
|
show usage examples
|
2020-04-12 17:24:34 +08:00
|
|
|
-forward value
|
2022-02-16 00:25:14 +08:00
|
|
|
forward url, see the URL section below
|
2020-04-12 17:24:34 +08:00
|
|
|
-include value
|
2022-02-16 00:25:14 +08:00
|
|
|
include file
|
2020-04-12 17:24:34 +08:00
|
|
|
-interface string
|
2022-02-16 00:25:14 +08:00
|
|
|
source ip or source interface
|
2020-04-12 17:24:34 +08:00
|
|
|
-listen value
|
2022-02-16 00:25:14 +08:00
|
|
|
listen url, see the URL section below
|
2021-07-17 23:43:22 +08:00
|
|
|
-logflags int
|
2022-02-16 00:25:14 +08:00
|
|
|
do not change it if you do not know what it is, ref: https://pkg.go.dev/log#pkg-constants (default 19)
|
2020-04-12 17:24:34 +08:00
|
|
|
-maxfailures int
|
2022-02-16 00:25:14 +08:00
|
|
|
max failures to change forwarder status to disabled (default 3)
|
2020-05-04 16:51:41 +08:00
|
|
|
-relaytimeout int
|
2022-02-16 00:25:14 +08:00
|
|
|
relay timeout(seconds)
|
2020-04-12 17:24:34 +08:00
|
|
|
-rulefile value
|
2022-02-16 00:25:14 +08:00
|
|
|
rule file path
|
2020-04-12 17:24:34 +08:00
|
|
|
-rules-dir string
|
2022-02-16 00:25:14 +08:00
|
|
|
rule file folder
|
2022-02-15 21:34:55 +08:00
|
|
|
-scheme string
|
2022-02-16 23:37:25 +08:00
|
|
|
show help message of proxy scheme, use 'all' to see all schemes
|
2020-10-01 19:29:53 +08:00
|
|
|
-service value
|
2022-02-16 00:25:14 +08:00
|
|
|
run specified services, format: SERVICE_NAME[,SERVICE_CONFIG]
|
2020-04-12 17:24:34 +08:00
|
|
|
-strategy string
|
2022-02-16 00:25:14 +08:00
|
|
|
rr: Round Robin mode
|
|
|
|
ha: High Availability mode
|
|
|
|
lha: Latency based High Availability mode
|
|
|
|
dh: Destination Hashing mode (default "rr")
|
2021-07-24 23:45:53 +08:00
|
|
|
-tcpbufsize int
|
2022-02-16 00:25:14 +08:00
|
|
|
tcp buffer size in Bytes (default 32768)
|
2021-07-24 23:45:53 +08:00
|
|
|
-udpbufsize int
|
2022-02-16 00:25:14 +08:00
|
|
|
udp buffer size in Bytes (default 2048)
|
2020-04-12 17:24:34 +08:00
|
|
|
-verbose
|
2022-02-16 00:25:14 +08:00
|
|
|
verbose mode
|
2022-02-15 21:34:55 +08:00
|
|
|
|
|
|
|
URL:
|
|
|
|
proxy: SCHEME://[USER:PASS@][HOST]:PORT
|
2022-02-16 00:25:14 +08:00
|
|
|
chain: proxy,proxy[,proxy]...
|
2022-02-15 21:34:55 +08:00
|
|
|
|
|
|
|
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:
|
2022-04-05 15:22:12 +08:00
|
|
|
listen : http kcp mixed pxyproto redir redir6 smux sni socks5 ss tcp tls tproxy trojan trojanc udp unix vless vsock ws wss
|
|
|
|
forward: direct http kcp reject simple-obfs smux socks4 socks4a socks5 ss ssh ssr tcp tls trojan trojanc udp unix vless vmess vsock ws wss
|
2022-02-15 21:34:55 +08:00
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
Note: use 'glider -scheme all' or 'glider -scheme SCHEME' to see help info for the scheme.
|
2022-02-15 21:34:55 +08:00
|
|
|
|
|
|
|
--
|
|
|
|
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...]
|
2022-02-23 22:20:06 +08:00
|
|
|
service=dhcpd-failover,INTERFACE,START_IP,END_IP,LEASE_MINUTES[,MAC=IP,MAC=IP...]
|
2022-02-15 21:34:55 +08:00
|
|
|
e.g. service=dhcpd,eth1,192.168.1.100,192.168.1.199,720
|
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
--
|
|
|
|
Help:
|
|
|
|
glider -help
|
|
|
|
glider -scheme all
|
|
|
|
glider -example
|
|
|
|
|
2022-02-15 21:34:55 +08:00
|
|
|
see README.md and glider.conf.example for more details.
|
|
|
|
--
|
2024-04-28 23:00:11 +08:00
|
|
|
glider 0.16.4, https://github.com/nadoo/glider (glider.proxy@gmail.com)
|
2021-04-28 00:53:41 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
2020-04-12 17:24:34 +08:00
|
|
|
|
2022-04-19 21:43:35 +08:00
|
|
|
#### Schemes
|
|
|
|
|
2021-04-28 00:53:41 +08:00
|
|
|
<details>
|
2022-03-06 12:58:20 +08:00
|
|
|
<summary><code>glider -scheme all</code></summary>
|
2021-04-28 00:53:41 +08:00
|
|
|
|
|
|
|
```bash
|
2022-05-03 18:19:33 +08:00
|
|
|
Direct scheme:
|
|
|
|
direct://
|
|
|
|
|
2024-04-28 23:00:11 +08:00
|
|
|
Only needed when you want to specify the outgoing interface:
|
|
|
|
glider -verbose -listen :8443 -forward direct://#interface=eth0
|
|
|
|
|
|
|
|
Or load balance multiple interfaces directly:
|
2022-05-03 18:19:33 +08:00
|
|
|
glider -verbose -listen :8443 -forward direct://#interface=eth0 -forward direct://#interface=eth1 -strategy rr
|
|
|
|
|
|
|
|
Or you can use the high availability mode:
|
|
|
|
glider -verbose -listen :8443 -forward direct://#interface=eth0&priority=100 -forward direct://#interface=eth1&priority=200 -strategy ha
|
|
|
|
|
|
|
|
--
|
2022-03-14 13:06:26 +08:00
|
|
|
Http scheme:
|
|
|
|
http://[user:pass@]host:port
|
|
|
|
|
|
|
|
--
|
2022-02-15 21:34:55 +08:00
|
|
|
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
|
2020-10-03 22:42:34 +08:00
|
|
|
|
2022-02-15 21:34:55 +08:00
|
|
|
--
|
|
|
|
Simple-Obfs scheme:
|
|
|
|
simple-obfs://host:port[?type=TYPE&host=HOST&uri=URI&ua=UA]
|
|
|
|
|
|
|
|
Available types for simple-obfs:
|
|
|
|
http, tls
|
2020-04-12 17:24:34 +08:00
|
|
|
|
2022-05-03 18:19:33 +08:00
|
|
|
--
|
|
|
|
Reject scheme:
|
|
|
|
reject://
|
|
|
|
|
2022-02-15 21:34:55 +08:00
|
|
|
--
|
|
|
|
Smux scheme:
|
|
|
|
smux://host:port
|
2020-04-12 17:24:34 +08:00
|
|
|
|
2022-03-14 13:06:26 +08:00
|
|
|
--
|
|
|
|
Socks4 scheme:
|
|
|
|
socks4://host:port
|
|
|
|
|
|
|
|
--
|
|
|
|
Socks5 scheme:
|
|
|
|
socks5://[user:pass@]host:port
|
|
|
|
|
2022-02-15 21:34:55 +08:00
|
|
|
--
|
|
|
|
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:
|
2022-03-14 13:06:26 +08:00
|
|
|
chacha20-ietf-poly1305 = AEAD_CHACHA20_POLY1305, xchacha20-ietf-poly1305 = AEAD_XCHACHA20_POLY1305
|
2022-02-15 21:34:55 +08:00
|
|
|
Plain: NONE
|
|
|
|
|
|
|
|
--
|
2020-05-04 13:53:59 +08:00
|
|
|
SSH scheme:
|
2021-12-09 19:22:12 +08:00
|
|
|
ssh://user[:pass]@host:port[?key=keypath&timeout=SECONDS]
|
|
|
|
timeout: timeout of ssh handshake and channel operation, default: 5
|
2020-05-04 13:53:59 +08:00
|
|
|
|
2022-02-15 21:34:55 +08:00
|
|
|
--
|
|
|
|
SSR scheme:
|
|
|
|
ssr://method:pass@host:port?protocol=xxx&protocol_param=yyy&obfs=zzz&obfs_param=xyz
|
2020-10-10 19:04:33 +08:00
|
|
|
|
2022-02-15 21:34:55 +08:00
|
|
|
--
|
2020-04-12 17:24:34 +08:00
|
|
|
TLS client scheme:
|
2021-08-20 18:47:15 +08:00
|
|
|
tls://host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&alpn=proto1][&alpn=proto2]
|
2022-02-15 21:34:55 +08:00
|
|
|
|
2020-04-12 17:24:34 +08:00
|
|
|
Proxy over tls client:
|
2020-07-14 18:35:48 +08:00
|
|
|
tls://host:port[?skipVerify=true][&serverName=SERVERNAME],scheme://
|
2020-04-12 17:24:34 +08:00
|
|
|
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
|
2022-02-15 21:34:55 +08:00
|
|
|
|
2020-04-12 17:24:34 +08:00
|
|
|
TLS server scheme:
|
2021-08-17 09:39:24 +08:00
|
|
|
tls://host:port?cert=PATH&key=PATH[&alpn=proto1][&alpn=proto2]
|
2022-02-15 21:34:55 +08:00
|
|
|
|
2020-04-12 17:24:34 +08:00
|
|
|
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@
|
|
|
|
|
2022-02-15 21:34:55 +08:00
|
|
|
--
|
|
|
|
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)
|
|
|
|
|
2022-03-14 13:06:26 +08:00
|
|
|
--
|
|
|
|
Unix domain socket scheme:
|
|
|
|
unix://path
|
|
|
|
|
2022-02-15 21:34:55 +08:00
|
|
|
--
|
|
|
|
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
|
|
|
|
|
|
|
|
--
|
2020-10-19 20:45:57 +08:00
|
|
|
Websocket client scheme:
|
2020-11-12 22:08:02 +08:00
|
|
|
ws://host:port[/path][?host=HOST][&origin=ORIGIN]
|
2021-08-20 18:47:15 +08:00
|
|
|
wss://host:port[/path][?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&host=HOST][&origin=ORIGIN]
|
2022-02-15 21:34:55 +08:00
|
|
|
|
2020-10-19 20:45:57 +08:00
|
|
|
Websocket server scheme:
|
2020-10-22 19:42:42 +08:00
|
|
|
ws://:port[/path][?host=HOST]
|
2021-07-09 19:17:16 +08:00
|
|
|
wss://:port[/path]?cert=PATH&key=PATH[?host=HOST]
|
2022-02-15 21:34:55 +08:00
|
|
|
|
2020-04-12 17:24:34 +08:00
|
|
|
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@]
|
2022-02-15 21:34:55 +08:00
|
|
|
|
2020-04-12 17:24:34 +08:00
|
|
|
TLS and Websocket with a specified proxy protocol:
|
2020-07-14 18:35:48 +08:00
|
|
|
tls://host:port[?skipVerify=true][&serverName=SERVERNAME],ws://[@/path[?host=HOST]],scheme://
|
2020-04-12 17:24:34 +08:00
|
|
|
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
|
2022-04-05 15:22:12 +08:00
|
|
|
|
|
|
|
--
|
2022-04-19 19:09:20 +08:00
|
|
|
VM socket scheme(linux only):
|
2022-04-06 18:47:04 +08:00
|
|
|
vsock://[CID]:port
|
|
|
|
|
|
|
|
if you want to listen on any address, just set CID to 4294967295.
|
2021-04-28 00:53:41 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
2020-12-04 12:41:38 +08:00
|
|
|
|
2022-04-19 21:43:35 +08:00
|
|
|
#### Examples
|
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
<details>
|
2022-03-06 12:58:20 +08:00
|
|
|
<summary><code>glider -example</code></summary>
|
2022-02-16 23:37:25 +08:00
|
|
|
|
|
|
|
```bash
|
|
|
|
Examples:
|
|
|
|
glider -config glider.conf
|
|
|
|
-run glider with specified config file.
|
2022-02-23 17:48:43 +08:00
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
glider -listen :8443 -verbose
|
|
|
|
-listen on :8443, serve as http/socks5 proxy on the same port, in verbose mode.
|
|
|
|
|
2022-02-23 17:48:43 +08:00
|
|
|
glider -listen socks5://:1080 -listen http://:8080 -verbose
|
|
|
|
-multiple listeners: listen on :1080 as socks5 proxy server, and on :8080 as http proxy server.
|
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
glider -listen :8443 -forward direct://#interface=eth0 -forward direct://#interface=eth1
|
2022-02-23 17:48:43 +08:00
|
|
|
-multiple forwarders: listen on 8443 and forward requests via interface eth0 and eth1 in round robin mode.
|
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
glider -listen tls://:443?cert=crtFilePath&key=keyFilePath,http:// -verbose
|
2022-02-23 17:48:43 +08:00
|
|
|
-protocol chain: listen on :443 as a https(http over tls) proxy server.
|
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
glider -listen http://:8080 -forward socks5://serverA:1080,socks5://serverB:1080
|
2022-02-23 17:48:43 +08:00
|
|
|
-proxy chain: listen on :8080 as a http proxy server, forward all requests via forward chain.
|
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
glider -listen :8443 -forward socks5://serverA:1080 -forward socks5://serverB:1080#priority=10 -forward socks5://serverC:1080#priority=10
|
2022-02-23 17:48:43 +08:00
|
|
|
-forwarder priority: serverA will only be used when serverB and serverC are not available.
|
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
glider -listen tcp://:80 -forward tcp://serverA:80
|
|
|
|
-tcp tunnel: listen on :80 and forward all requests to serverA:80.
|
2022-02-23 17:48:43 +08:00
|
|
|
|
2022-02-16 23:37:25 +08:00
|
|
|
glider -listen udp://:53 -forward socks5://serverA:1080,udp://8.8.8.8:53
|
2022-02-23 17:48:43 +08:00
|
|
|
-udp tunnel: listen on :53 and forward all udp requests to 8.8.8.8:53 via remote socks5 server.
|
|
|
|
|
2022-05-27 18:22:43 +08:00
|
|
|
glider -verbose -dns=:53 -dnsserver=8.8.8.8:53 -forward socks5://serverA:1080 -dnsrecord=abc.com/1.2.3.4
|
2022-02-23 17:48:43 +08:00
|
|
|
-dns over proxy: listen on :53 as dns server, forward to 8.8.8.8:53 via socks5 server.
|
2022-02-16 23:37:25 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
2020-04-12 17:48:04 +08:00
|
|
|
## Config
|
|
|
|
|
2022-05-03 18:19:33 +08:00
|
|
|
```bash
|
|
|
|
glider -config CONFIG_PATH
|
|
|
|
```
|
|
|
|
|
2020-04-12 17:48:04 +08:00
|
|
|
- [ConfigFile](config)
|
|
|
|
- [glider.conf.example](config/glider.conf.example)
|
|
|
|
- [office.rule.example](config/rules.d/office.rule.example)
|
|
|
|
- [Examples](config/examples)
|
|
|
|
- [transparent proxy with dnsmasq](config/examples/8.transparent_proxy_with_dnsmasq)
|
|
|
|
- [transparent proxy without dnsmasq](config/examples/9.transparent_proxy_without_dnsmasq)
|
|
|
|
|
2020-10-02 19:31:03 +08:00
|
|
|
## Service
|
|
|
|
|
2022-03-14 13:06:26 +08:00
|
|
|
- dhcpd / dhcpd-failover:
|
2021-06-10 20:09:21 +08:00
|
|
|
- service=dhcpd,INTERFACE,START_IP,END_IP,LEASE_MINUTES[,MAC=IP,MAC=IP...]
|
2022-03-14 13:06:26 +08:00
|
|
|
- service=dhcpd,eth1,192.168.1.100,192.168.1.199,720,fc:23:34:9e:25:01=192.168.1.101
|
|
|
|
- service=dhcpd-failover,eth2,192.168.2.100,192.168.2.199,720
|
2022-03-06 12:58:20 +08:00
|
|
|
- note: `dhcpd-failover` only serves requests when there's no other dhcp server exists in lan
|
|
|
|
- detect interval: 1min
|
2020-10-02 19:31:03 +08:00
|
|
|
|
2022-04-05 09:30:04 +08:00
|
|
|
## Linux Daemon
|
2020-10-02 19:31:03 +08:00
|
|
|
|
|
|
|
- systemd: [https://github.com/nadoo/glider/blob/master/systemd/](https://github.com/nadoo/glider/blob/master/systemd/)
|
|
|
|
|
2022-03-14 13:06:26 +08:00
|
|
|
- <details> <summary>docker: click to see details</summary>
|
|
|
|
|
2022-03-16 12:01:09 +08:00
|
|
|
- run glider (config file path: /etc/glider/glider.conf)
|
2022-03-14 13:06:26 +08:00
|
|
|
```
|
2022-03-16 12:01:09 +08:00
|
|
|
docker run -d --name glider --net host --restart=always \
|
|
|
|
-v /etc/glider:/etc/glider \
|
2022-04-22 23:30:39 +08:00
|
|
|
-v /etc/localtime:/etc/localtime:ro \
|
2022-03-16 12:01:09 +08:00
|
|
|
nadoo/glider -config=/etc/glider/glider.conf
|
2022-03-14 13:06:26 +08:00
|
|
|
```
|
2022-05-05 17:12:45 +08:00
|
|
|
- run watchtower if you need auto update
|
2022-03-14 13:06:26 +08:00
|
|
|
```
|
|
|
|
docker run -d --name watchtower --restart=always \
|
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
2022-03-16 12:01:09 +08:00
|
|
|
containrrr/watchtower --interval 21600 --cleanup \
|
|
|
|
glider
|
2022-03-14 13:06:26 +08:00
|
|
|
```
|
2022-05-05 17:12:45 +08:00
|
|
|
- open udp ports if you need udp nat fullcone
|
2022-03-14 13:06:26 +08:00
|
|
|
```
|
2022-03-16 12:01:09 +08:00
|
|
|
iptables -I INPUT -p udp -m udp --dport 1024:65535 -j ACCEPT
|
2022-03-14 13:06:26 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
2020-10-02 19:31:03 +08:00
|
|
|
## Customize Build
|
|
|
|
|
|
|
|
<details><summary>You can customize and build glider if you want a smaller binary (click to see details)</summary>
|
|
|
|
|
|
|
|
|
|
|
|
1. Clone the source code:
|
|
|
|
```bash
|
2021-04-19 10:39:40 +08:00
|
|
|
git clone https://github.com/nadoo/glider && cd glider
|
2020-10-02 19:31:03 +08:00
|
|
|
```
|
|
|
|
2. Customize features:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
open `feature.go` & `feature_linux.go`, comment out the packages you don't need
|
|
|
|
// _ "github.com/nadoo/glider/proxy/kcp"
|
|
|
|
```
|
|
|
|
|
2023-11-28 18:26:33 +08:00
|
|
|
3. Build it:
|
2020-10-02 19:31:03 +08:00
|
|
|
```bash
|
2021-04-19 10:39:40 +08:00
|
|
|
go build -v -ldflags "-s -w"
|
2020-10-02 19:31:03 +08:00
|
|
|
```
|
|
|
|
|
2022-03-14 13:06:26 +08:00
|
|
|
</details>
|
2020-10-02 19:31:03 +08:00
|
|
|
|
2020-04-12 17:24:34 +08:00
|
|
|
## Proxy & Protocol Chains
|
2020-04-14 00:17:46 +08:00
|
|
|
<details><summary>In glider, you can easily chain several proxy servers or protocols together (click to see details)</summary>
|
2018-12-14 00:02:25 +08:00
|
|
|
|
|
|
|
- Chain proxy servers:
|
|
|
|
|
2020-04-19 17:03:39 +08:00
|
|
|
```bash
|
|
|
|
forward=http://1.1.1.1:80,socks5://2.2.2.2:1080,ss://method:pass@3.3.3.3:8443@
|
|
|
|
```
|
2018-12-14 00:02:25 +08:00
|
|
|
|
|
|
|
- Chain protocols: https proxy (http over tls)
|
|
|
|
|
2020-04-19 17:03:39 +08:00
|
|
|
```bash
|
2020-10-12 19:07:54 +08:00
|
|
|
forward=tls://server.com:443,http://
|
2020-04-19 17:03:39 +08:00
|
|
|
```
|
2018-12-14 00:02:25 +08:00
|
|
|
|
|
|
|
- Chain protocols: vmess over ws over tls
|
|
|
|
|
2020-04-19 17:03:39 +08:00
|
|
|
```bash
|
2020-10-12 19:07:54 +08:00
|
|
|
forward=tls://server.com:443,ws://,vmess://5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2
|
2020-04-19 17:03:39 +08:00
|
|
|
```
|
2018-12-14 00:02:25 +08:00
|
|
|
|
|
|
|
- Chain protocols and servers:
|
|
|
|
|
2020-04-19 17:03:39 +08:00
|
|
|
``` bash
|
2020-10-12 19:07:54 +08:00
|
|
|
forward=socks5://1.1.1.1:1080,tls://server.com:443,vmess://5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2
|
2020-04-19 17:03:39 +08:00
|
|
|
```
|
2018-12-14 00:02:25 +08:00
|
|
|
|
|
|
|
- Chain protocols in listener: https proxy server
|
|
|
|
|
2020-04-19 17:03:39 +08:00
|
|
|
``` bash
|
|
|
|
listen=tls://:443?cert=crtFilePath&key=keyFilePath,http://
|
|
|
|
```
|
2018-12-14 00:02:25 +08:00
|
|
|
|
2021-05-05 18:41:48 +08:00
|
|
|
- Chain protocols in listener: http over smux over websocket proxy server
|
|
|
|
|
|
|
|
``` bash
|
|
|
|
listen=ws://:10000,smux://,http://
|
|
|
|
```
|
|
|
|
|
2020-04-14 00:17:46 +08:00
|
|
|
</details>
|
2018-12-14 00:02:25 +08:00
|
|
|
|
2017-07-18 19:45:35 +08:00
|
|
|
## Links
|
2018-08-01 00:47:43 +08:00
|
|
|
|
2020-09-26 23:34:26 +08:00
|
|
|
- [ipset](https://github.com/nadoo/ipset): netlink ipset package for Go.
|
2020-09-25 13:17:16 +08:00
|
|
|
- [conflag](https://github.com/nadoo/conflag): a drop-in replacement for Go's standard flag package with config file support.
|
2023-11-28 18:26:33 +08:00
|
|
|
- [ArchLinux](https://archlinux.org/packages/extra/x86_64/glider): a great linux distribution with glider pre-built package.
|
2020-10-01 19:29:53 +08:00
|
|
|
- [urlencode](https://www.w3schools.com/tags/ref_urlencode.asp): you should encode special characters in scheme url. e.g., `@`->`%40`
|