This commit is contained in:
DHR60 2026-02-09 10:48:54 +08:00
parent 810c4f5302
commit 3314b4ac8c

View file

@ -1233,19 +1233,11 @@ public static class ConfigHandler
/// <returns>A SOCKS profile item or null if not needed</returns>
public static ProfileItem? GetPreSocksItem(Config config, ProfileItem node, ECoreType coreType)
{
ProfileItem? itemSocks = null;
if (node.ConfigType != EConfigType.Custom && coreType != ECoreType.sing_box && config.TunModeItem.EnableTun)
if (node.ConfigType != EConfigType.Custom || !(node.PreSocksPort > 0))
{
itemSocks = new ProfileItem()
{
CoreType = ECoreType.sing_box,
ConfigType = EConfigType.SOCKS,
Address = Global.Loopback,
Port = AppManager.Instance.GetLocalPort(EInboundProtocol.socks)
};
return null;
}
else if (node.ConfigType == EConfigType.Custom && node.PreSocksPort > 0)
{
ProfileItem? itemSocks = null;
var preCoreType = AppManager.Instance.RunningCoreType = config.TunModeItem.EnableTun ? ECoreType.sing_box : ECoreType.Xray;
itemSocks = new ProfileItem()
{
@ -1254,7 +1246,6 @@ public static class ConfigHandler
Address = Global.Loopback,
Port = node.PreSocksPort.Value,
};
}
return itemSocks;
}