mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 01:15:41 +08:00
general: update some doc or comment for new features.
This commit is contained in:
parent
20616dfd10
commit
ac94540ab8
@ -219,7 +219,7 @@ Available forward strategies:
|
||||
rr: Round Robin mode
|
||||
ha: High Availability mode
|
||||
lha: Latency based High Availability mode
|
||||
dh: destination hashing mode
|
||||
dh: Destination Hashing mode
|
||||
|
||||
Forwarder option scheme: FORWARD_URL#OPTIONS
|
||||
priority: set the priority of that forwarder, default:0
|
||||
|
2
conf.go
2
conf.go
@ -191,7 +191,7 @@ func usage() {
|
||||
fmt.Fprintf(os.Stderr, " rr: Round Robin 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, " dh: destination hashing mode\n")
|
||||
fmt.Fprintf(os.Stderr, " dh: Destination Hashing mode\n")
|
||||
fmt.Fprintf(os.Stderr, "\n")
|
||||
|
||||
fmt.Fprintf(os.Stderr, "Forwarder option scheme: FORWARD_URL#OPTIONS\n")
|
||||
|
@ -60,12 +60,22 @@ listen=socks5://:1080
|
||||
# Forwarders, we can setup multiple forwarders.
|
||||
# forward=SCHEME#OPTIONS
|
||||
|
||||
# FORWARDER OPTIONS
|
||||
# priority: set the priority of that forwarder, default:0
|
||||
# interface: set local interface or ip address used to connect remote server
|
||||
|
||||
# Socks5 proxy as forwarder
|
||||
# forward=socks5://192.168.1.10:1080
|
||||
|
||||
# Socks5 proxy as forwarder with priority 100
|
||||
# forward=socks5://192.168.1.10:1080#priority=100
|
||||
|
||||
# Socks5 proxy as forwarder with priority 100 and use `eth0` as source interface
|
||||
# forward=socks5://192.168.1.10:1080#priority=100&interface=eth0
|
||||
|
||||
# Socks5 proxy as forwarder with priority 100 and use `192.168.1.100` as source ip
|
||||
# forward=socks5://192.168.1.10:1080#priority=100&interface=192.168.1.100
|
||||
|
||||
# SS proxy as forwarder
|
||||
# forward=ss://method:pass@1.1.1.1:8443
|
||||
|
||||
|
@ -14,9 +14,8 @@ import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/nadoo/glider/rule"
|
||||
|
||||
"github.com/nadoo/glider/common/log"
|
||||
"github.com/nadoo/glider/rule"
|
||||
)
|
||||
|
||||
// NFNL_SUBSYS_IPSET netfilter netlink message types
|
||||
|
@ -155,6 +155,7 @@ func (d *Dialer) initAvailable() {
|
||||
}
|
||||
|
||||
if len(d.available) == 0 {
|
||||
log.F("[strategy] no available forwarders, just use: %s, please check your settings or network", d.fwdrs[0])
|
||||
d.available = append(d.available, d.fwdrs[0])
|
||||
}
|
||||
}
|
||||
@ -239,14 +240,17 @@ func (d *Dialer) check(i int) {
|
||||
}
|
||||
}
|
||||
|
||||
// Round Robin
|
||||
func (d *Dialer) scheduleRR(dstAddr string) *proxy.Forwarder {
|
||||
return d.available[atomic.AddUint32(&d.index, 1)%uint32(len(d.available))]
|
||||
}
|
||||
|
||||
// High Availability
|
||||
func (d *Dialer) scheduleHA(dstAddr string) *proxy.Forwarder {
|
||||
return d.available[0]
|
||||
}
|
||||
|
||||
// Latency based High Availability
|
||||
func (d *Dialer) scheduleLHA(dstAddr string) *proxy.Forwarder {
|
||||
fwdr := d.available[0]
|
||||
lowest := fwdr.Latency()
|
||||
@ -256,10 +260,10 @@ func (d *Dialer) scheduleLHA(dstAddr string) *proxy.Forwarder {
|
||||
fwdr = f
|
||||
}
|
||||
}
|
||||
|
||||
return fwdr
|
||||
}
|
||||
|
||||
// Destination Hashing
|
||||
func (d *Dialer) scheduleDH(dstAddr string) *proxy.Forwarder {
|
||||
fnv1a := fnv.New32a()
|
||||
fnv1a.Write([]byte(dstAddr))
|
||||
|
Loading…
Reference in New Issue
Block a user