From d6ca317b206ee8f8c53f41d755e3a78ee15a1076 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sat, 31 Aug 2024 10:12:21 +0800 Subject: [PATCH] xray mux add more option https://github.com/2dust/v2rayN/issues/5565 --- v2rayN/ServiceLib/Handler/ConfigHandler.cs | 7 +++++++ .../ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs | 4 +++- v2rayN/ServiceLib/Models/Config.cs | 1 + v2rayN/ServiceLib/Models/ConfigItems.cs | 8 ++++++++ v2rayN/ServiceLib/Models/V2rayConfig.cs | 11 +++-------- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 8d2bfe6d..601bec23 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -173,6 +173,13 @@ namespace ServiceLib.Handler config.speedTestItem.speedPingTestUrl = Global.SpeedPingTestUrl; } + config.mux4RayItem ??= new() + { + concurrency = 8, + xudpConcurrency = 16, + xudpProxyUDP443 = "reject" + }; + if (config.mux4SboxItem == null) { config.mux4SboxItem = new() diff --git a/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs b/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs index 9e092ae3..3c11bae2 100644 --- a/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs +++ b/v2rayN/ServiceLib/Handler/CoreConfig/CoreConfigV2ray.cs @@ -770,7 +770,9 @@ namespace ServiceLib.Handler.CoreConfig if (enabled) { outbound.mux.enabled = true; - outbound.mux.concurrency = 8; + outbound.mux.concurrency = _config.mux4RayItem.concurrency; + outbound.mux.xudpConcurrency = _config.mux4RayItem.xudpConcurrency; + outbound.mux.xudpProxyUDP443 = _config.mux4RayItem.xudpProxyUDP443; } else { diff --git a/v2rayN/ServiceLib/Models/Config.cs b/v2rayN/ServiceLib/Models/Config.cs index 062cd501..1c943547 100644 --- a/v2rayN/ServiceLib/Models/Config.cs +++ b/v2rayN/ServiceLib/Models/Config.cs @@ -41,6 +41,7 @@ public UIItem uiItem { get; set; } public ConstItem constItem { get; set; } public SpeedTestItem speedTestItem { get; set; } + public Mux4RayItem mux4RayItem { get; set; } public Mux4SboxItem mux4SboxItem { get; set; } public HysteriaItem hysteriaItem { get; set; } public ClashUIItem clashUIItem { get; set; } diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs index 1f816a51..7ddcf376 100644 --- a/v2rayN/ServiceLib/Models/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/ConfigItems.cs @@ -197,6 +197,14 @@ public int Index { get; set; } } + [Serializable] + public class Mux4RayItem + { + public int? concurrency { get; set; } + public int? xudpConcurrency { get; set; } + public string? xudpProxyUDP443 { get; set; } + } + [Serializable] public class Mux4SboxItem { diff --git a/v2rayN/ServiceLib/Models/V2rayConfig.cs b/v2rayN/ServiceLib/Models/V2rayConfig.cs index 1118a193..6335db48 100644 --- a/v2rayN/ServiceLib/Models/V2rayConfig.cs +++ b/v2rayN/ServiceLib/Models/V2rayConfig.cs @@ -343,15 +343,10 @@ namespace ServiceLib.Models public class Mux4Ray { - /// - /// - /// public bool enabled { get; set; } - - /// - /// - /// - public int concurrency { get; set; } + public int? concurrency { get; set; } + public int? xudpConcurrency { get; set; } + public string? xudpProxyUDP443 { get; set; } } public class Response4Ray