ginuerzh / gost

GO Simple Tunnel - a simple tunnel written in golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

当使用普通端口转发时无法使用peer进行复杂负载均衡

franocisgar opened this issue · comments

我知道peer是要用协议代理的。
但我是想做一个复杂的端口转发负载均衡。

-L tcp://:8080/1.1.1.1:8080,2.2.2.2:8080,3.3.3.3:8080

是可行的,但我想先对1.1.1.1:8080和2.2.2.2:8080进行random轮询,如果这两个建立不起连接,最后再fifo进3.3.3.3:8080

-L tcp://:8080/1.1.1.1:8080,2.2.2.2:8080,3.3.3.3:8080?peer=8080.txt

以及8080.txt为

strategy        fifo
max_fails       1
fail_timeout    30s

reload          10s

# peers
peer    1.1.1.1:8080?ip=8080ips.txt
peer    3.3.3.3:8080

8080ips.txt为

1.1.1.1
2.2.2.2

时无法使用?peer=8080.txt参数,会默认进行端口转发中的round模式

有什么办法可以达成先对1.1.1.1:8080和2.2.2.2:8080进行random轮询,如果这两个建立不起连接,最后再fifo进3.3.3.3:8080吗?

我有一个想法
先监听8080转发去本地8081 和3.3.3.3:8080进行fifo,然后再8081端口进行random负载均衡

-L tcp://:8080/127.0.0.1:8081,3.3.3.3:8080?ip=127.0.0.1:8081,3.3.3.3:8080&strategy=fifo&max_fails=1&fail_timeout=60s
-L tcp://:8081/1.1.1.1:8080,2.2.2.2:8080?ip=1.1.1.1:8080,2.2.2.2:8080&strategy=random&max_fails=1&fail_timeout=60s

不知道能不能达成相对应的效果,但这样的话有点复杂

以及如果我在

-L tcp://:8081/1.1.1.1:8080,2.2.2.2:8080?ip=1.1.1.1:8080,2.2.2.2:8080&strategy=random&max_fails=1&fail_timeout=60s

中使用iplist.txt的话 ip=iplist.txt可以热更新吗?