From ac4692c7d08fb89c4a797bace24f03953c6ba180 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Thu, 24 Jul 2025 20:50:59 +0800 Subject: [PATCH] Fixes SplitCore == false and Node.CoreType == ECoreType.hysteria2 etc. logic --- v2rayN/ServiceLib/Handler/CoreHandler.cs | 28 +++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/v2rayN/ServiceLib/Handler/CoreHandler.cs b/v2rayN/ServiceLib/Handler/CoreHandler.cs index 5e53e47b..14530e05 100644 --- a/v2rayN/ServiceLib/Handler/CoreHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreHandler.cs @@ -225,6 +225,24 @@ public class CoreHandler PreCoreType = null; } } + else if (!SplitCore && !EnableTun) + { + switch (Node.CoreType) + { + case ECoreType.hysteria2: + case ECoreType.tuic: + Node.CoreType = ECoreType.sing_box; + CoreType = ECoreType.sing_box; + break; + case ECoreType.v2fly: + case ECoreType.v2fly_v5: + Node.CoreType = ECoreType.Xray; + CoreType = ECoreType.Xray; + break; + default: + break; + } + } } /// @@ -251,15 +269,15 @@ public class CoreHandler { PreCoreType = ECoreType.sing_box; - if (PreCoreType != CoreType) // CoreType is xray + if (PreCoreType == CoreType) // CoreType is sing_box + { + PreCoreType = null; + } + else // CoreType is xray, hysteria2, tuic, etc. { SplitCore = true; PreSocksPort = AppHandler.Instance.GetLocalPort(EInboundProtocol.split); } - else // CoreType is sing_box - { - PreCoreType = null; - } } } }