From 4d2f32099e66a0103eaa82d1dabe0ef018645234 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Tue, 3 Mar 2026 10:07:48 +0800 Subject: [PATCH] Bug fix https://github.com/2dust/v2rayN/issues/8879 --- .../V2ray/CoreConfigV2rayService.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs index e5182c97..ca8eeb0d 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs @@ -301,6 +301,7 @@ public partial class CoreConfigV2rayService(CoreConfigContext context) GenLog(); _coreConfig.outbounds.Clear(); GenOutbounds(); + GenStatistic(); var protectNode = new ProfileItem() { @@ -326,18 +327,17 @@ public partial class CoreConfigV2rayService(CoreConfigContext context) Node = protectNode, }).BuildProxyOutbound("tun-project-ss")); + _coreConfig.routing.rules ??= []; var hasBalancer = _coreConfig.routing.balancers is { Count: > 0 }; - _coreConfig.routing.rules = - [ - new() - { - inboundTag = new List { "proxy-relay-ss" }, - outboundTag = hasBalancer ? null : Global.ProxyTag, - balancerTag = hasBalancer ? Global.ProxyTag + Global.BalancerTagSuffix: null, - type = "field" - } - ]; - _coreConfig.inbounds.Clear(); + _coreConfig.routing.rules.Add(new() + { + inboundTag = ["proxy-relay-ss"], + outboundTag = hasBalancer ? null : Global.ProxyTag, + balancerTag = hasBalancer ? Global.ProxyTag + Global.BalancerTagSuffix : null, + type = "field" + }); + + //_coreConfig.inbounds.Clear(); var configNode = JsonUtils.ParseJson(JsonUtils.Serialize(_coreConfig))!; configNode["inbounds"]!.AsArray().Add(new