Fix possible issues with load balancing

https://github.com/2dust/v2rayN/issues/6429
pull/6443/head
2dust 2025-01-05 14:49:53 +08:00
parent aae5906311
commit 5d4bd2fee6
3 changed files with 19 additions and 22 deletions

View File

@ -5,24 +5,25 @@
"loglevel": "warning" "loglevel": "warning"
}, },
"inbounds": [], "inbounds": [],
"outbounds": [{ "outbounds": [
{
"tag": "proxy", "tag": "proxy",
"protocol": "vmess", "protocol": "vmess",
"settings": { "settings": {
"vnext": [{ "vnext": [{
"address": "v2ray.cool", "address": "",
"port": 10086, "port": 0,
"users": [{ "users": [{
"id": "a3482e88-686a-4a58-8126-99c9df64b7bf", "id": "",
"security": "auto" "security": "auto"
}] }]
}], }],
"servers": [{ "servers": [{
"address": "v2ray.cool", "address": "",
"method": "chacha20", "method": "",
"ota": false, "ota": false,
"password": "123456", "password": "",
"port": 10086, "port": 0,
"level": 1 "level": 1
}] }]
}, },
@ -35,24 +36,20 @@
}, },
{ {
"protocol": "freedom", "protocol": "freedom",
"settings": {},
"tag": "direct" "tag": "direct"
}, },
{ {
"protocol": "blackhole", "protocol": "blackhole",
"tag": "block", "tag": "block"
"settings": {
"response": {
"type": "http"
}
}
} }
], ],
"routing": { "routing": {
"domainStrategy": "IPIfNonMatch", "domainStrategy": "IPIfNonMatch",
"rules": [ "rules": [
{ {
"inboundTag": ["api"], "inboundTag": [
"api"
],
"outboundTag": "api", "outboundTag": "api",
"type": "field" "type": "field"
} }

View File

@ -313,7 +313,7 @@ namespace ServiceLib.Services.CoreConfig
var outbound = JsonUtils.Deserialize<Outbound4Sbox>(txtOutbound); var outbound = JsonUtils.Deserialize<Outbound4Sbox>(txtOutbound);
await GenOutbound(item, outbound); await GenOutbound(item, outbound);
outbound.tag = $"{Global.ProxyTag}-{tagProxy.Count + 1}"; outbound.tag = $"{Global.ProxyTag}-{tagProxy.Count + 1}";
singboxConfig.outbounds.Add(outbound); singboxConfig.outbounds.Insert(0, outbound);
tagProxy.Add(outbound.tag); tagProxy.Add(outbound.tag);
} }
if (tagProxy.Count <= 0) if (tagProxy.Count <= 0)

View File

@ -154,7 +154,7 @@ namespace ServiceLib.Services.CoreConfig
var outbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound); var outbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound);
await GenOutbound(item, outbound); await GenOutbound(item, outbound);
outbound.tag = $"{Global.ProxyTag}-{tagProxy.Count + 1}"; outbound.tag = $"{Global.ProxyTag}-{tagProxy.Count + 1}";
v2rayConfig.outbounds.Add(outbound); v2rayConfig.outbounds.Insert(0, outbound);
tagProxy.Add(outbound.tag); tagProxy.Add(outbound.tag);
} }
if (tagProxy.Count <= 0) if (tagProxy.Count <= 0)