From f00e968b8fb95aa5783c087fba2f0771bd5c5253 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sat, 13 Sep 2025 09:41:34 +0800 Subject: [PATCH] Bug fix https://github.com/2dust/v2rayN/issues/7944 --- .../Services/CoreConfig/Singbox/SingboxRoutingService.cs | 7 +++++++ .../Services/CoreConfig/V2ray/V2rayRoutingService.cs | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs index 0b364785..9fec047c 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs @@ -368,6 +368,13 @@ public partial class CoreConfigSingboxService return Global.ProxyTag; } + var tag = Global.ProxyTag + node.IndexId.ToString(); + if (singboxConfig.outbounds.Any(o => o.tag == tag) + || (singboxConfig.endpoints != null && singboxConfig.endpoints.Any(e => e.tag == tag))) + { + return tag; + } + var server = await GenServer(node); if (server is null) { diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayRoutingService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayRoutingService.cs index 1cb46bf2..d39ea833 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayRoutingService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayRoutingService.cs @@ -131,10 +131,16 @@ public partial class CoreConfigV2rayService return Global.ProxyTag; } + var tag = Global.ProxyTag + node.IndexId.ToString(); + if (v2rayConfig.outbounds.Any(p => p.tag == tag)) + { + return tag; + } + var txtOutbound = EmbedUtils.GetEmbedText(Global.V2raySampleOutbound); var outbound = JsonUtils.Deserialize(txtOutbound); await GenOutbound(node, outbound); - outbound.tag = Global.ProxyTag + node.IndexId.ToString(); + outbound.tag = tag; v2rayConfig.outbounds.Add(outbound); return outbound.tag;