From 8f5cbad9881092331d90ae5ec2c219e3e871be80 Mon Sep 17 00:00:00 2001
From: DHR60 <192860629+DHR60@users.noreply.github.com>
Date: Wed, 15 Jul 2026 09:23:21 +0000
Subject: [PATCH] Xray precore for custom config (#9754)
* Xray precore for custom config
* Fix
* Custom Pre
---------
Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
---
v2rayN/ServiceLib/Handler/ConfigHandler.cs | 3 ++-
v2rayN/ServiceLib/Manager/AppManager.cs | 2 +-
v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml | 2 +-
v2rayN/v2rayN/Views/OptionSettingWindow.xaml | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
index 9f401fba..89b8b2f6 100644
--- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs
+++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
@@ -1511,7 +1511,8 @@ public static class ConfigHandler
else if (node.ConfigType == EConfigType.Custom
&& node.PreSocksPort is > 0 and <= 65535)
{
- var preCoreType = config.TunModeItem.EnableTun ? ECoreType.sing_box : ECoreType.Xray;
+ var customPreCoreType = AppManager.Instance.GetCoreType(null, EConfigType.Custom);
+ var preCoreType = (enableLegacyProtect && config.TunModeItem.EnableTun) ? ECoreType.sing_box : customPreCoreType;
itemSocks = new ProfileItem()
{
CoreType = preCoreType,
diff --git a/v2rayN/ServiceLib/Manager/AppManager.cs b/v2rayN/ServiceLib/Manager/AppManager.cs
index de16cf35..72d29305 100644
--- a/v2rayN/ServiceLib/Manager/AppManager.cs
+++ b/v2rayN/ServiceLib/Manager/AppManager.cs
@@ -663,7 +663,7 @@ public sealed class AppManager
return Global.SsSecuritiesInSingbox;
}
- public ECoreType GetCoreType(ProfileItem profileItem, EConfigType eConfigType)
+ public ECoreType GetCoreType(ProfileItem? profileItem, EConfigType eConfigType)
{
if (profileItem?.CoreType != null)
{
diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml
index 926de8a4..5b39896b 100644
--- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml
@@ -1114,7 +1114,7 @@
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
- Text="Custom" />
+ Text="Custom Pre" />
+ Text="Custom Pre" />