From 1a33c598e88997219141729a6fdef8648b4b4921 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Mon, 16 Dec 2024 21:01:03 +0800 Subject: [PATCH] Disable mux when using xhttp --- v2rayN/ServiceLib/Models/V2rayConfig.cs | 12 ------------ .../CoreConfig/CoreConfigV2rayService.cs | 18 +++++++----------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/v2rayN/ServiceLib/Models/V2rayConfig.cs b/v2rayN/ServiceLib/Models/V2rayConfig.cs index 23dfb3f946b..c7e48bd12e0 100644 --- a/v2rayN/ServiceLib/Models/V2rayConfig.cs +++ b/v2rayN/ServiceLib/Models/V2rayConfig.cs @@ -350,21 +350,9 @@ public class XhttpSettings4Ray public string? path { get; set; } public string? host { get; set; } public string? mode { get; set; } - public object? scMaxEachPostBytes { get; set; } - public object? scMaxConcurrentPosts { get; set; } - public object? scMinPostsIntervalMs { get; set; } - //public Xmux4Ray? xmux { get; set; } public object? extra { get; set; } } - //public class Xmux4Ray - //{ - // public object? maxConcurrency { get; set; } - // public object? maxConnections { get; set; } - // public object? cMaxReuseTimes { get; set; } - // public object? cMaxLifetimeMs { get; set; } - //} - public class HttpSettings4Ray { public string? path { get; set; } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs index fffab122e08..1db2c7d6e5e 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs @@ -700,8 +700,7 @@ private async Task GenOutbound(ProfileItem node, Outbounds4Ray outbound) await GenOutboundMux(node, outbound, _config.CoreBasicItem.MuxEnabled); - if (node.StreamSecurity == Global.StreamSecurityReality - || node.StreamSecurity == Global.StreamSecurity) + if (node.StreamSecurity == Global.StreamSecurityReality || node.StreamSecurity == Global.StreamSecurity) { if (Utils.IsNotEmpty(node.Flow)) { @@ -745,7 +744,7 @@ private async Task GenOutbound(ProfileItem node, Outbounds4Ray outbound) } outbound.protocol = Global.ProtocolTypes[node.ConfigType]; - await GenBoundStreamSettings(node, outbound.streamSettings); + await GenBoundStreamSettings(node, outbound); } catch (Exception ex) { @@ -778,10 +777,11 @@ private async Task GenOutboundMux(ProfileItem node, Outbounds4Ray outbound, return 0; } - private async Task GenBoundStreamSettings(ProfileItem node, StreamSettings4Ray streamSettings) + private async Task GenBoundStreamSettings(ProfileItem node, Outbounds4Ray outbound) { try { + var streamSettings = outbound.streamSettings; streamSettings.network = node.GetNetwork(); var host = node.RequestHost.TrimEx(); var path = node.Path.TrimEx(); @@ -869,7 +869,7 @@ private async Task GenBoundStreamSettings(ProfileItem node, StreamSettings4 case nameof(ETransport.ws): WsSettings4Ray wsSettings = new(); wsSettings.headers = new Headers4Ray(); - + if (Utils.IsNotEmpty(host)) { wsSettings.host = host; @@ -904,12 +904,7 @@ private async Task GenBoundStreamSettings(ProfileItem node, StreamSettings4 //xhttp case nameof(ETransport.xhttp): streamSettings.network = ETransport.xhttp.ToString(); - XhttpSettings4Ray xhttpSettings = new() - { - scMaxEachPostBytes = "500000-1000000", - scMaxConcurrentPosts = "50-100", - scMinPostsIntervalMs = "30-50" - }; + XhttpSettings4Ray xhttpSettings = new(); if (Utils.IsNotEmpty(path)) { @@ -929,6 +924,7 @@ private async Task GenBoundStreamSettings(ProfileItem node, StreamSettings4 } streamSettings.xhttpSettings = xhttpSettings; + await GenOutboundMux(node, outbound, false); break; //h2