Load balancing with multiple servers (or relays)
Is it possible to use multiple brook servers (and/or relays) for load balancing?
something like this:
/opt/brook/brook client --server server1:9999 --server server2:9999 --server relay1:9999 --server relay2:9999 --password hello --socks5 127.0.0.1:1080
I achieved this using v2ray and brook. Traffic routes through v2ray first then balances across multiple brook and v2ray servers.
You could also run a few servers behind CloudFlare/AWS and load balance them. I've just started testing this and so far it works as expected.
@creativebastard could you please share a v2ray config sample for routing to brook? I'm using brook websocket, not sure how to use v2ray's reverse proxy for this.
{
"log": {
"error" : "/var/log/v2ray/error.log",
"loglevel" : "warning",
"access" : "/var/log/v2ray/access.log"
},
"stats": {},
"inbounds": [{}],
"outbounds": [
{
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 1080
}
]
},
"tag": "brook-1"
},
{
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 1081
}
]
},
"tag": "brook-2"
},
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
},
{
"protocol": "blackhole",
"settings": {},
"tag": "adblock"
}
],
"routing": {
"domainStrategy": "AsIs",
"balancers": [
{
"tag": "b1",
"selector": [
"brook-1",
"brook-2"
]
}
],
"rules": [
{
"type": "field",
"outboundTag": "brook-1",
"domain": [
"domain:something.com"
]
},
{
"type": "field",
"outboundTag": "direct",
"domain": [
"domain:something",
]
},
{
"type": "field",
"outboundTag": "brook-2",
"domain": [
"domain:another.com"
]
},
{
"type": "field",
"network": "tcp,udp",
"balancerTag": "b1"
}
]
}
}
You can do this script brooklinks, checkout https://brook.app