From 4f56174c8fb6663e6993b191e6e93f36c9808fd7 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:16:53 +0800 Subject: [PATCH] Bug fix https://github.com/2dust/v2rayN/issues/6219 --- v2rayN/ServiceLib/Handler/ConfigHandler.cs | 5 ++--- v2rayN/ServiceLib/Handler/CoreHandler.cs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index d7079097..1639592f 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -1029,12 +1029,11 @@ namespace ServiceLib.Handler public static async Task GetPreSocksItem(Config config, ProfileItem node, ECoreType coreType) { ProfileItem? itemSocks = null; - var preCoreType = ECoreType.sing_box; if (node.ConfigType != EConfigType.Custom && coreType != ECoreType.sing_box && config.TunModeItem.EnableTun) { itemSocks = new ProfileItem() { - CoreType = preCoreType, + CoreType = ECoreType.sing_box, ConfigType = EConfigType.SOCKS, Address = Global.Loopback, Sni = node.Address, //Tun2SocksAddress @@ -1043,7 +1042,7 @@ namespace ServiceLib.Handler } else if ((node.ConfigType == EConfigType.Custom && node.PreSocksPort > 0)) { - preCoreType = config.TunModeItem.EnableTun ? ECoreType.sing_box : ECoreType.Xray; + var preCoreType = config.RunningCoreType = config.TunModeItem.EnableTun ? ECoreType.sing_box : ECoreType.Xray; itemSocks = new ProfileItem() { CoreType = preCoreType, diff --git a/v2rayN/ServiceLib/Handler/CoreHandler.cs b/v2rayN/ServiceLib/Handler/CoreHandler.cs index 78bc505e..60c7175a 100644 --- a/v2rayN/ServiceLib/Handler/CoreHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreHandler.cs @@ -174,7 +174,7 @@ namespace ServiceLib.Handler var itemSocks = await ConfigHandler.GetPreSocksItem(_config, node, coreType); if (itemSocks != null) { - var preCoreType = _config.RunningCoreType = itemSocks.CoreType ?? ECoreType.sing_box; + var preCoreType = itemSocks.CoreType ?? ECoreType.sing_box; var fileName = Utils.GetConfigPath(Global.CorePreConfigFileName); var result = await CoreConfigHandler.GenerateClientConfig(itemSocks, fileName); if (result.Success)