From 04efed2079caba7adb32244f4df7dea39147f498 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 13 Nov 2024 19:48:44 +0800 Subject: [PATCH] SplitHTTP is now XHTTP for xray --- v2rayN/ServiceLib/Enums/ETransport.cs | 1 + v2rayN/ServiceLib/Global.cs | 2 +- v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs | 2 ++ v2rayN/ServiceLib/Models/V2rayConfig.cs | 19 +++++++++++++------ v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 4 ++-- v2rayN/ServiceLib/Resx/ResUI.resx | 4 ++-- v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 4 ++-- v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 4 ++-- .../CoreConfig/CoreConfigSingboxService.cs | 2 +- .../CoreConfig/CoreConfigV2rayService.cs | 17 ++++++++++------- .../Statistics/StatisticsXrayService.cs | 2 +- .../Views/AddServerWindow.axaml.cs | 1 + v2rayN/v2rayN/Views/AddServerWindow.xaml.cs | 1 + 13 files changed, 39 insertions(+), 24 deletions(-) diff --git a/v2rayN/ServiceLib/Enums/ETransport.cs b/v2rayN/ServiceLib/Enums/ETransport.cs index f313db9c..ccf3e7f8 100644 --- a/v2rayN/ServiceLib/Enums/ETransport.cs +++ b/v2rayN/ServiceLib/Enums/ETransport.cs @@ -7,6 +7,7 @@ ws, httpupgrade, splithttp, + xhttp, h2, http, quic, diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index 426a6da4..3509e2e2 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -178,7 +178,7 @@ public static readonly List SsSecuritiesInXray = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "none", "plain", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305" }; public static readonly List SsSecuritiesInSingbox = new() { "aes-256-gcm", "aes-192-gcm", "aes-128-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "rc4-md5", "chacha20-ietf", "xchacha20" }; public static readonly List Flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" }; - public static readonly List Networks = new() { "tcp", "kcp", "ws", "httpupgrade", "splithttp", "h2", "quic", "grpc" }; + public static readonly List Networks = new() { "tcp", "kcp", "ws", "httpupgrade", "xhttp", "splithttp", "h2", "quic", "grpc" }; public static readonly List KcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" }; public static readonly List CoreTypes = new() { "v2fly", "Xray", "sing_box" }; public static readonly List CoreTypes4VLESS = new() { "Xray", "sing_box" }; diff --git a/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs index 6520ca64..00663e6f 100644 --- a/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs +++ b/v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs @@ -84,6 +84,7 @@ namespace ServiceLib.Handler.Fmt case nameof(ETransport.ws): case nameof(ETransport.httpupgrade): case nameof(ETransport.splithttp): + case nameof(ETransport.xhttp): if (Utils.IsNotEmpty(item.RequestHost)) { dicQuery.Add("host", Utils.UrlEncode(item.RequestHost)); @@ -157,6 +158,7 @@ namespace ServiceLib.Handler.Fmt case nameof(ETransport.ws): case nameof(ETransport.httpupgrade): case nameof(ETransport.splithttp): + case nameof(ETransport.xhttp): item.RequestHost = Utils.UrlDecode(query["host"] ?? ""); item.Path = Utils.UrlDecode(query["path"] ?? "/"); break; diff --git a/v2rayN/ServiceLib/Models/V2rayConfig.cs b/v2rayN/ServiceLib/Models/V2rayConfig.cs index b5623398..1edb383d 100644 --- a/v2rayN/ServiceLib/Models/V2rayConfig.cs +++ b/v2rayN/ServiceLib/Models/V2rayConfig.cs @@ -258,7 +258,7 @@ namespace ServiceLib.Models public HttpupgradeSettings4Ray? httpupgradeSettings { get; set; } - public SplithttpSettings4Ray? splithttpSettings { get; set; } + public XhttpSettings4Ray? xhttpSettings { get; set; } public HttpSettings4Ray? httpSettings { get; set; } @@ -344,15 +344,22 @@ namespace ServiceLib.Models public string? host { get; set; } } - public class SplithttpSettings4Ray + public class XhttpSettings4Ray { public string? path { get; set; } - public string? host { get; set; } + public string? scMaxEachPostBytes { get; set; } + public string? scMaxConcurrentPosts { get; set; } + public string? scMinPostsIntervalMs { get; set; } + public Xmux4Ray? xmux { get; set; } + } - public int? maxUploadSize { get; set; } - - public int? maxConcurrentUploads { get; set; } + public class Xmux4Ray + { + public int? maxConcurrency { get; set; } + public int? maxConnections { get; set; } + public int? cMaxReuseTimes { get; set; } + public int? cMaxLifetimeMs { get; set; } } public class HttpSettings4Ray diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index ccb2b939..2eaaaa8a 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -3734,7 +3734,7 @@ namespace ServiceLib.Resx { } /// - /// 查找类似 *ws/httpupgrade/splithttp path 的本地化字符串。 + /// 查找类似 *ws/httpupgrade/xhttp path 的本地化字符串。 /// public static string TransportPathTip1 { get { @@ -3788,7 +3788,7 @@ namespace ServiceLib.Resx { } /// - /// 查找类似 *ws/httpupgrade/splithttp host 的本地化字符串。 + /// 查找类似 *ws/httpupgrade/xhttp host 的本地化字符串。 /// public static string TransportRequestHostTip2 { get { diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index c5238179..d952cbbb 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -344,7 +344,7 @@ Please fill in the correct custom DNS - *ws/httpupgrade/splithttp path + *ws/httpupgrade/xhttp path *h2 path @@ -359,7 +359,7 @@ *http host Separated by commas (,) - *ws/httpupgrade/splithttp host + *ws/httpupgrade/xhttp host *h2 host Separated by commas (,) diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index 07f9b463..9b86c88a 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -344,7 +344,7 @@ 请填写正确的自定义DNS - *ws/httpupgrade/splithttp path + *ws/httpupgrade/xhttp path *h2 path @@ -359,7 +359,7 @@ *http host中间逗号(,)分隔 - *ws/httpupgrade/splithttp host + *ws/httpupgrade/xhttp host *h2 host中间逗号(,)分隔 diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index 1a172b35..c93f92fa 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -343,7 +343,7 @@ 請填寫正確的自訂DNS - *ws/httpupgrade/splithttp path + *ws/httpupgrade/xhttp path *h2 path @@ -358,7 +358,7 @@ *http host中間逗號(,)分隔 - *ws/httpupgrade/splithttp host + *ws/httpupgrade/xhttp host *h2 host中間逗號(,)分隔 diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs index 986168d0..adfffa91 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs @@ -26,7 +26,7 @@ namespace ServiceLib.Services.CoreConfig ret.Msg = ResUI.CheckServerSettings; return ret; } - if (node.GetNetwork() is nameof(ETransport.kcp) or nameof(ETransport.splithttp)) + if (node.GetNetwork() is nameof(ETransport.kcp) or nameof(ETransport.splithttp) or nameof(ETransport.xhttp)) { ret.Msg = ResUI.Incorrectconfiguration + $" - {node.GetNetwork()}"; return ret; diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs index 6eb9d4bb..1babb504 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs @@ -926,23 +926,26 @@ namespace ServiceLib.Services.CoreConfig streamSettings.httpupgradeSettings = httpupgradeSettings; break; - //splithttp + //splithttp //xhttp case nameof(ETransport.splithttp): - SplithttpSettings4Ray splithttpSettings = new() + case nameof(ETransport.xhttp): + streamSettings.network = ETransport.xhttp.ToString(); + XhttpSettings4Ray xhttpSettings = new() { - maxUploadSize = 1000000, - maxConcurrentUploads = 10 + scMaxEachPostBytes = "500000-1000000", + scMaxConcurrentPosts = "50-100", + scMinPostsIntervalMs = "30-50" }; if (Utils.IsNotEmpty(node.Path)) { - splithttpSettings.path = node.Path; + xhttpSettings.path = node.Path; } if (Utils.IsNotEmpty(host)) { - splithttpSettings.host = host; + xhttpSettings.host = host; } - streamSettings.splithttpSettings = splithttpSettings; + streamSettings.xhttpSettings = xhttpSettings; break; //h2 diff --git a/v2rayN/ServiceLib/Services/Statistics/StatisticsXrayService.cs b/v2rayN/ServiceLib/Services/Statistics/StatisticsXrayService.cs index 72a51905..274e0f2e 100644 --- a/v2rayN/ServiceLib/Services/Statistics/StatisticsXrayService.cs +++ b/v2rayN/ServiceLib/Services/Statistics/StatisticsXrayService.cs @@ -31,7 +31,7 @@ await Task.Delay(1000); try { - if (!_config.IsRunningCore(ECoreType.Xray)) + if (_config.RunningCoreType != ECoreType.Xray) { continue; } diff --git a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml.cs index 4ad21c7a..9f8dc83b 100644 --- a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml.cs @@ -338,6 +338,7 @@ namespace v2rayN.Desktop.Views case nameof(ETransport.ws): case nameof(ETransport.httpupgrade): case nameof(ETransport.splithttp): + case nameof(ETransport.xhttp): tipRequestHost.Text = ResUI.TransportRequestHostTip2; tipPath.Text = ResUI.TransportPathTip1; break; diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index 2cb5a685..7b3c531b 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -333,6 +333,7 @@ namespace v2rayN.Views case nameof(ETransport.ws): case nameof(ETransport.httpupgrade): case nameof(ETransport.splithttp): + case nameof(ETransport.xhttp): tipRequestHost.Text = ResUI.TransportRequestHostTip2; tipPath.Text = ResUI.TransportPathTip1; break;