SplitHTTP is now XHTTP for xray

pull/6079/head
2dust 2024-11-13 19:48:44 +08:00
parent 2de9e14c7d
commit 04efed2079
13 changed files with 39 additions and 24 deletions

View File

@ -7,6 +7,7 @@
ws, ws,
httpupgrade, httpupgrade,
splithttp, splithttp,
xhttp,
h2, h2,
http, http,
quic, quic,

View File

@ -178,7 +178,7 @@
public static readonly List<string> 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<string> 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<string> 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<string> 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<string> Flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" }; public static readonly List<string> Flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" };
public static readonly List<string> Networks = new() { "tcp", "kcp", "ws", "httpupgrade", "splithttp", "h2", "quic", "grpc" }; public static readonly List<string> Networks = new() { "tcp", "kcp", "ws", "httpupgrade", "xhttp", "splithttp", "h2", "quic", "grpc" };
public static readonly List<string> KcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" }; public static readonly List<string> KcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" };
public static readonly List<string> CoreTypes = new() { "v2fly", "Xray", "sing_box" }; public static readonly List<string> CoreTypes = new() { "v2fly", "Xray", "sing_box" };
public static readonly List<string> CoreTypes4VLESS = new() { "Xray", "sing_box" }; public static readonly List<string> CoreTypes4VLESS = new() { "Xray", "sing_box" };

View File

@ -84,6 +84,7 @@ namespace ServiceLib.Handler.Fmt
case nameof(ETransport.ws): case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade): case nameof(ETransport.httpupgrade):
case nameof(ETransport.splithttp): case nameof(ETransport.splithttp):
case nameof(ETransport.xhttp):
if (Utils.IsNotEmpty(item.RequestHost)) if (Utils.IsNotEmpty(item.RequestHost))
{ {
dicQuery.Add("host", Utils.UrlEncode(item.RequestHost)); dicQuery.Add("host", Utils.UrlEncode(item.RequestHost));
@ -157,6 +158,7 @@ namespace ServiceLib.Handler.Fmt
case nameof(ETransport.ws): case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade): case nameof(ETransport.httpupgrade):
case nameof(ETransport.splithttp): case nameof(ETransport.splithttp):
case nameof(ETransport.xhttp):
item.RequestHost = Utils.UrlDecode(query["host"] ?? ""); item.RequestHost = Utils.UrlDecode(query["host"] ?? "");
item.Path = Utils.UrlDecode(query["path"] ?? "/"); item.Path = Utils.UrlDecode(query["path"] ?? "/");
break; break;

View File

@ -258,7 +258,7 @@ namespace ServiceLib.Models
public HttpupgradeSettings4Ray? httpupgradeSettings { get; set; } public HttpupgradeSettings4Ray? httpupgradeSettings { get; set; }
public SplithttpSettings4Ray? splithttpSettings { get; set; } public XhttpSettings4Ray? xhttpSettings { get; set; }
public HttpSettings4Ray? httpSettings { get; set; } public HttpSettings4Ray? httpSettings { get; set; }
@ -344,15 +344,22 @@ namespace ServiceLib.Models
public string? host { get; set; } public string? host { get; set; }
} }
public class SplithttpSettings4Ray public class XhttpSettings4Ray
{ {
public string? path { get; set; } public string? path { get; set; }
public string? host { 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 class Xmux4Ray
{
public int? maxConcurrentUploads { get; set; } public int? maxConcurrency { get; set; }
public int? maxConnections { get; set; }
public int? cMaxReuseTimes { get; set; }
public int? cMaxLifetimeMs { get; set; }
} }
public class HttpSettings4Ray public class HttpSettings4Ray

View File

@ -3734,7 +3734,7 @@ namespace ServiceLib.Resx {
} }
/// <summary> /// <summary>
/// 查找类似 *ws/httpupgrade/splithttp path 的本地化字符串。 /// 查找类似 *ws/httpupgrade/xhttp path 的本地化字符串。
/// </summary> /// </summary>
public static string TransportPathTip1 { public static string TransportPathTip1 {
get { get {
@ -3788,7 +3788,7 @@ namespace ServiceLib.Resx {
} }
/// <summary> /// <summary>
/// 查找类似 *ws/httpupgrade/splithttp host 的本地化字符串。 /// 查找类似 *ws/httpupgrade/xhttp host 的本地化字符串。
/// </summary> /// </summary>
public static string TransportRequestHostTip2 { public static string TransportRequestHostTip2 {
get { get {

View File

@ -344,7 +344,7 @@
<value>Please fill in the correct custom DNS</value> <value>Please fill in the correct custom DNS</value>
</data> </data>
<data name="TransportPathTip1" xml:space="preserve"> <data name="TransportPathTip1" xml:space="preserve">
<value>*ws/httpupgrade/splithttp path</value> <value>*ws/httpupgrade/xhttp path</value>
</data> </data>
<data name="TransportPathTip2" xml:space="preserve"> <data name="TransportPathTip2" xml:space="preserve">
<value>*h2 path</value> <value>*h2 path</value>
@ -359,7 +359,7 @@
<value>*http host Separated by commas (,)</value> <value>*http host Separated by commas (,)</value>
</data> </data>
<data name="TransportRequestHostTip2" xml:space="preserve"> <data name="TransportRequestHostTip2" xml:space="preserve">
<value>*ws/httpupgrade/splithttp host</value> <value>*ws/httpupgrade/xhttp host</value>
</data> </data>
<data name="TransportRequestHostTip3" xml:space="preserve"> <data name="TransportRequestHostTip3" xml:space="preserve">
<value>*h2 host Separated by commas (,)</value> <value>*h2 host Separated by commas (,)</value>

View File

@ -344,7 +344,7 @@
<value>请填写正确的自定义DNS</value> <value>请填写正确的自定义DNS</value>
</data> </data>
<data name="TransportPathTip1" xml:space="preserve"> <data name="TransportPathTip1" xml:space="preserve">
<value>*ws/httpupgrade/splithttp path</value> <value>*ws/httpupgrade/xhttp path</value>
</data> </data>
<data name="TransportPathTip2" xml:space="preserve"> <data name="TransportPathTip2" xml:space="preserve">
<value>*h2 path</value> <value>*h2 path</value>
@ -359,7 +359,7 @@
<value>*http host中间逗号(,)分隔</value> <value>*http host中间逗号(,)分隔</value>
</data> </data>
<data name="TransportRequestHostTip2" xml:space="preserve"> <data name="TransportRequestHostTip2" xml:space="preserve">
<value>*ws/httpupgrade/splithttp host</value> <value>*ws/httpupgrade/xhttp host</value>
</data> </data>
<data name="TransportRequestHostTip3" xml:space="preserve"> <data name="TransportRequestHostTip3" xml:space="preserve">
<value>*h2 host中间逗号(,)分隔</value> <value>*h2 host中间逗号(,)分隔</value>

View File

@ -343,7 +343,7 @@
<value>請填寫正確的自訂DNS</value> <value>請填寫正確的自訂DNS</value>
</data> </data>
<data name="TransportPathTip1" xml:space="preserve"> <data name="TransportPathTip1" xml:space="preserve">
<value>*ws/httpupgrade/splithttp path</value> <value>*ws/httpupgrade/xhttp path</value>
</data> </data>
<data name="TransportPathTip2" xml:space="preserve"> <data name="TransportPathTip2" xml:space="preserve">
<value>*h2 path</value> <value>*h2 path</value>
@ -358,7 +358,7 @@
<value>*http host中間逗號(,)分隔</value> <value>*http host中間逗號(,)分隔</value>
</data> </data>
<data name="TransportRequestHostTip2" xml:space="preserve"> <data name="TransportRequestHostTip2" xml:space="preserve">
<value>*ws/httpupgrade/splithttp host</value> <value>*ws/httpupgrade/xhttp host</value>
</data> </data>
<data name="TransportRequestHostTip3" xml:space="preserve"> <data name="TransportRequestHostTip3" xml:space="preserve">
<value>*h2 host中間逗號(,)分隔</value> <value>*h2 host中間逗號(,)分隔</value>

View File

@ -26,7 +26,7 @@ namespace ServiceLib.Services.CoreConfig
ret.Msg = ResUI.CheckServerSettings; ret.Msg = ResUI.CheckServerSettings;
return ret; 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()}"; ret.Msg = ResUI.Incorrectconfiguration + $" - {node.GetNetwork()}";
return ret; return ret;

View File

@ -926,23 +926,26 @@ namespace ServiceLib.Services.CoreConfig
streamSettings.httpupgradeSettings = httpupgradeSettings; streamSettings.httpupgradeSettings = httpupgradeSettings;
break; break;
//splithttp //splithttp //xhttp
case nameof(ETransport.splithttp): case nameof(ETransport.splithttp):
SplithttpSettings4Ray splithttpSettings = new() case nameof(ETransport.xhttp):
streamSettings.network = ETransport.xhttp.ToString();
XhttpSettings4Ray xhttpSettings = new()
{ {
maxUploadSize = 1000000, scMaxEachPostBytes = "500000-1000000",
maxConcurrentUploads = 10 scMaxConcurrentPosts = "50-100",
scMinPostsIntervalMs = "30-50"
}; };
if (Utils.IsNotEmpty(node.Path)) if (Utils.IsNotEmpty(node.Path))
{ {
splithttpSettings.path = node.Path; xhttpSettings.path = node.Path;
} }
if (Utils.IsNotEmpty(host)) if (Utils.IsNotEmpty(host))
{ {
splithttpSettings.host = host; xhttpSettings.host = host;
} }
streamSettings.splithttpSettings = splithttpSettings; streamSettings.xhttpSettings = xhttpSettings;
break; break;
//h2 //h2

View File

@ -31,7 +31,7 @@
await Task.Delay(1000); await Task.Delay(1000);
try try
{ {
if (!_config.IsRunningCore(ECoreType.Xray)) if (_config.RunningCoreType != ECoreType.Xray)
{ {
continue; continue;
} }

View File

@ -338,6 +338,7 @@ namespace v2rayN.Desktop.Views
case nameof(ETransport.ws): case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade): case nameof(ETransport.httpupgrade):
case nameof(ETransport.splithttp): case nameof(ETransport.splithttp):
case nameof(ETransport.xhttp):
tipRequestHost.Text = ResUI.TransportRequestHostTip2; tipRequestHost.Text = ResUI.TransportRequestHostTip2;
tipPath.Text = ResUI.TransportPathTip1; tipPath.Text = ResUI.TransportPathTip1;
break; break;

View File

@ -333,6 +333,7 @@ namespace v2rayN.Views
case nameof(ETransport.ws): case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade): case nameof(ETransport.httpupgrade):
case nameof(ETransport.splithttp): case nameof(ETransport.splithttp):
case nameof(ETransport.xhttp):
tipRequestHost.Text = ResUI.TransportRequestHostTip2; tipRequestHost.Text = ResUI.TransportRequestHostTip2;
tipPath.Text = ResUI.TransportPathTip1; tipPath.Text = ResUI.TransportPathTip1;
break; break;