Bug fix
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release Linux / rpm (push) Blocked by required conditions
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run

https://github.com/2dust/v2rayN/issues/8879
This commit is contained in:
2dust 2026-03-03 10:07:48 +08:00
parent f24a79aa2c
commit 4d2f32099e

View file

@ -301,6 +301,7 @@ public partial class CoreConfigV2rayService(CoreConfigContext context)
GenLog(); GenLog();
_coreConfig.outbounds.Clear(); _coreConfig.outbounds.Clear();
GenOutbounds(); GenOutbounds();
GenStatistic();
var protectNode = new ProfileItem() var protectNode = new ProfileItem()
{ {
@ -326,18 +327,17 @@ public partial class CoreConfigV2rayService(CoreConfigContext context)
Node = protectNode, Node = protectNode,
}).BuildProxyOutbound("tun-project-ss")); }).BuildProxyOutbound("tun-project-ss"));
_coreConfig.routing.rules ??= [];
var hasBalancer = _coreConfig.routing.balancers is { Count: > 0 }; var hasBalancer = _coreConfig.routing.balancers is { Count: > 0 };
_coreConfig.routing.rules = _coreConfig.routing.rules.Add(new()
[
new()
{ {
inboundTag = new List<string> { "proxy-relay-ss" }, inboundTag = ["proxy-relay-ss"],
outboundTag = hasBalancer ? null : Global.ProxyTag, outboundTag = hasBalancer ? null : Global.ProxyTag,
balancerTag = hasBalancer ? Global.ProxyTag + Global.BalancerTagSuffix : null, balancerTag = hasBalancer ? Global.ProxyTag + Global.BalancerTagSuffix : null,
type = "field" type = "field"
} });
];
_coreConfig.inbounds.Clear(); //_coreConfig.inbounds.Clear();
var configNode = JsonUtils.ParseJson(JsonUtils.Serialize(_coreConfig))!; var configNode = JsonUtils.ParseJson(JsonUtils.Serialize(_coreConfig))!;
configNode["inbounds"]!.AsArray().Add(new configNode["inbounds"]!.AsArray().Add(new