doc: add info for forwarder option: priority

This commit is contained in:
nadoo 2018-08-14 19:52:32 +08:00
parent e82ea75cba
commit 4967f0bd36
4 changed files with 27 additions and 4 deletions

View File

@ -56,7 +56,7 @@ General:
- Http and socks5 on the same port - Http and socks5 on the same port
- Forward chain - Forward chain
- HA or RR strategy for multiple forwarders - RR/HA/LHA strategy for multiple forwarders
- Periodical proxy checking - Periodical proxy checking
- Rule proxy based on destinations: [Config Examples](config/examples) - Rule proxy based on destinations: [Config Examples](config/examples)
@ -109,7 +109,7 @@ glider -config CONFIGPATH -listen :8080 -verbose
## Usage ## Usage
```bash ```bash
glider v0.6.6 usage: glider v0.6.7 usage:
-checkduration int -checkduration int
proxy check interval(seconds) (default 30) proxy check interval(seconds) (default 30)
-checkwebsite string -checkwebsite string
@ -134,6 +134,8 @@ glider v0.6.6 usage:
ipset name ipset name
-listen value -listen value
listen url, format: SCHEME://[USER|METHOD:PASSWORD@][HOST]:PORT?PARAMS listen url, format: SCHEME://[USER|METHOD:PASSWORD@][HOST]:PORT?PARAMS
-maxfailures int
max failures to change forwarder status to disabled (default 3)
-rulefile value -rulefile value
rule file path rule file path
-rules-dir string -rules-dir string
@ -211,6 +213,14 @@ DNS forwarding server:
Available forward strategies: Available forward strategies:
rr: Round Robin mode rr: Round Robin mode
ha: High Availability mode ha: High Availability mode
lha: Latency based High Availability mode
Forwarder option scheme: FORWARD_URL[#OPTIONS]
Available options for forwarders:
priority: set the priority of that forwarder, default:0
Examples:
socks5://1.1.1.1:1080#priority=100
vmess://[security:]uuid@host:port?alterID=num#priority=200
Config file format(see `glider.conf.example` as an example): Config file format(see `glider.conf.example` as an example):
# COMMENT LINE # COMMENT LINE

View File

@ -188,6 +188,15 @@ func usage() {
fmt.Fprintf(os.Stderr, "Available forward strategies:\n") fmt.Fprintf(os.Stderr, "Available forward strategies:\n")
fmt.Fprintf(os.Stderr, " rr: Round Robin mode\n") fmt.Fprintf(os.Stderr, " rr: Round Robin mode\n")
fmt.Fprintf(os.Stderr, " ha: High Availability mode\n") fmt.Fprintf(os.Stderr, " ha: High Availability mode\n")
fmt.Fprintf(os.Stderr, " lha: Latency based High Availability mode\n")
fmt.Fprintf(os.Stderr, "\n")
fmt.Fprintf(os.Stderr, "Forwarder option scheme: FORWARD_URL[#OPTIONS]\n")
fmt.Fprintf(os.Stderr, " Available options for forwarders:\n")
fmt.Fprintf(os.Stderr, " priority: set the priority of that forwarder, default:0\n")
fmt.Fprintf(os.Stderr, " Examples:\n")
fmt.Fprintf(os.Stderr, " socks5://1.1.1.1:1080#priority=100\n")
fmt.Fprintf(os.Stderr, " vmess://[security:]uuid@host:port?alterID=num#priority=200\n")
fmt.Fprintf(os.Stderr, "\n") fmt.Fprintf(os.Stderr, "\n")
fmt.Fprintf(os.Stderr, "Config file format(see `"+app+".conf.example` as an example):\n") fmt.Fprintf(os.Stderr, "Config file format(see `"+app+".conf.example` as an example):\n")

View File

@ -58,10 +58,14 @@ listen=socks5://:1080
# FORWARDERS # FORWARDERS
# ---------- # ----------
# Forwarders, we can setup multiple forwarders. # Forwarders, we can setup multiple forwarders.
# forward=SCHEME#OPTIONS
# Socks5 proxy as forwarder # Socks5 proxy as forwarder
# forward=socks5://192.168.1.10:1080 # forward=socks5://192.168.1.10:1080
# Socks5 proxy as forwarder with priority 100
# forward=socks5://192.168.1.10:1080#priority=100
# SS proxy as forwarder # SS proxy as forwarder
# forward=ss://method:pass@1.1.1.1:8443 # forward=ss://method:pass@1.1.1.1:8443

View File

@ -235,9 +235,9 @@ func (ha *haDialer) DialUDP(network, addr string) (pc net.PacketConn, writeTo ne
return d.DialUDP(network, addr) return d.DialUDP(network, addr)
} }
// high availability forwarder // latency based high availability forwarder
// 1. choose dialer whose priority is the highest // 1. choose dialer whose priority is the highest
// 2. choose dialer whose letency it the lowest // 2. choose dialer with the lowest latency
type lhaDialer struct { type lhaDialer struct {
*rrDialer *rrDialer
} }