Custom configuration file to use Xray prefix in non-Tun mode

https://github.com/2dust/v2rayN/issues/4855
pull/4917/head
2dust 2024-04-01 08:22:14 +08:00
parent ee3159b00e
commit 1aef49ee11
7 changed files with 10 additions and 9 deletions

View File

@ -208,18 +208,19 @@ namespace v2rayN.Handler
{ {
if ((node.configType == EConfigType.Custom && node.preSocksPort > 0)) if ((node.configType == EConfigType.Custom && node.preSocksPort > 0))
{ {
var preCoreType = _config.tunModeItem.enableTun ? ECoreType.sing_box : ECoreType.Xray;
var itemSocks = new ProfileItem() var itemSocks = new ProfileItem()
{ {
coreType = ECoreType.sing_box, coreType = preCoreType,
configType = EConfigType.Socks, configType = EConfigType.Socks,
address = Global.Loopback, address = Global.Loopback,
port = node.preSocksPort port = node.preSocksPort
}; };
_config.runningCoreType = ECoreType.sing_box; _config.runningCoreType = preCoreType;
string fileName2 = Utils.GetConfigPath(Global.CorePreConfigFileName); string fileName2 = Utils.GetConfigPath(Global.CorePreConfigFileName);
if (CoreConfigHandler.GenerateClientConfig(itemSocks, fileName2, out string msg2, out string configStr) == 0) if (CoreConfigHandler.GenerateClientConfig(itemSocks, fileName2, out string msg2, out string configStr) == 0)
{ {
var coreInfo2 = LazyConfig.Instance.GetCoreInfo(ECoreType.sing_box); var coreInfo2 = LazyConfig.Instance.GetCoreInfo(preCoreType);
var proc2 = RunProcess(node, coreInfo2, $" -c {Global.CorePreConfigFileName}", true); var proc2 = RunProcess(node, coreInfo2, $" -c {Global.CorePreConfigFileName}", true);
if (proc2 is not null) if (proc2 is not null)
{ {

View File

@ -3149,7 +3149,7 @@ namespace v2rayN.Resx {
} }
/// <summary> /// <summary>
/// 查找类似 * After setting this value, an socks service will be started using sing-box to provide functions such as speed display 的本地化字符串。 /// 查找类似 * After setting this value, an socks service will be started using Xray/sing-box(Tun) to provide functions such as speed display 的本地化字符串。
/// </summary> /// </summary>
public static string TipPreSocksPort { public static string TipPreSocksPort {
get { get {

View File

@ -698,7 +698,7 @@
<value>txtPreSocksPort</value> <value>txtPreSocksPort</value>
</data> </data>
<data name="TipPreSocksPort" xml:space="preserve"> <data name="TipPreSocksPort" xml:space="preserve">
<value>* After setting this value, an socks service will be started using sing-box to provide functions such as speed display</value> <value>* After setting this value, an socks service will be started using Xray/sing-box(Tun) to provide functions such as speed display</value>
</data> </data>
<data name="TbBrowse" xml:space="preserve"> <data name="TbBrowse" xml:space="preserve">
<value>Browse</value> <value>Browse</value>

View File

@ -701,7 +701,7 @@
<value>txtPreSocksPort</value> <value>txtPreSocksPort</value>
</data> </data>
<data name="TipPreSocksPort" xml:space="preserve"> <data name="TipPreSocksPort" xml:space="preserve">
<value>* After setting this value, an socks service will be started using sing-box to provide functions such as speed display</value> <value>* After setting this value, an socks service will be started using Xray/sing-box(Tun) to provide functions such as speed display</value>
</data> </data>
<data name="TbBrowse" xml:space="preserve"> <data name="TbBrowse" xml:space="preserve">
<value>Browse</value> <value>Browse</value>

View File

@ -701,7 +701,7 @@
<value>txtPreSocksPort</value> <value>txtPreSocksPort</value>
</data> </data>
<data name="TipPreSocksPort" xml:space="preserve"> <data name="TipPreSocksPort" xml:space="preserve">
<value>* После установки этого значения служба socks будет запущена с использованием sing-box для обеспечения таких функций, как отображение скорости</value> <value>* После установки этого значения служба socks будет запущена с использованием Xray/sing-box(Tun) для обеспечения таких функций, как отображение скорости</value>
</data> </data>
<data name="TbBrowse" xml:space="preserve"> <data name="TbBrowse" xml:space="preserve">
<value>Просмотр</value> <value>Просмотр</value>

View File

@ -701,7 +701,7 @@
<value>Socks端口</value> <value>Socks端口</value>
</data> </data>
<data name="TipPreSocksPort" xml:space="preserve"> <data name="TipPreSocksPort" xml:space="preserve">
<value>* 自定义配置的Socks端口值可不设置当设置此值后将使用sing-box额外启动一个前置Socks服务提供分流和速度显示等功能</value> <value>* 自定义配置的Socks端口值可不设置当设置此值后将使用Xray/sing-box(Tun)额外启动一个前置Socks服务提供分流和速度显示等功能</value>
</data> </data>
<data name="TbBrowse" xml:space="preserve"> <data name="TbBrowse" xml:space="preserve">
<value>浏览</value> <value>浏览</value>

View File

@ -700,7 +700,7 @@
<value>SOCKS埠</value> <value>SOCKS埠</value>
</data> </data>
<data name="TipPreSocksPort" xml:space="preserve"> <data name="TipPreSocksPort" xml:space="preserve">
<value>* 自訂配置的Socks埠值可不設定當設定此值後將使用sing-box額外啟動一個前置Socks服務提供分流和速度顯示等功能</value> <value>* 自訂配置的Socks埠值可不設定當設定此值後將使用Xray/sing-box(Tun)額外啟動一個前置Socks服務提供分流和速度顯示等功能</value>
</data> </data>
<!--********************************************--> <!--********************************************-->
<data name="TbBrowse" xml:space="preserve"> <data name="TbBrowse" xml:space="preserve">