Add splithttp transport for xray

https://github.com/XTLS/Xray-core/releases/tag/v1.8.15
pull/5264/head
2dust 2024-06-20 16:20:05 +08:00
parent 123c49c22d
commit 522571f0b3
12 changed files with 60 additions and 19 deletions

View File

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

View File

@ -157,7 +157,7 @@ namespace v2rayN
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", "h2", "quic", "grpc" }; public static readonly List<string> Networks = new() { "tcp", "kcp", "ws", "httpupgrade", "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", "SagerNet", "Xray", "sing_box" }; public static readonly List<string> CoreTypes = new() { "v2fly", "SagerNet", "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

@ -26,7 +26,7 @@ namespace v2rayN.Handler.CoreConfig
msg = ResUI.CheckServerSettings; msg = ResUI.CheckServerSettings;
return -1; return -1;
} }
if (node.GetNetwork() == nameof(ETransport.kcp)) if (node.GetNetwork() is nameof(ETransport.kcp) or nameof(ETransport.splithttp))
{ {
msg = ResUI.Incorrectconfiguration + $" - {node.GetNetwork()}"; msg = ResUI.Incorrectconfiguration + $" - {node.GetNetwork()}";
return -1; return -1;

View File

@ -565,6 +565,7 @@ namespace v2rayN.Handler.CoreConfig
publicKey = node.publicKey, publicKey = node.publicKey,
shortId = node.shortId, shortId = node.shortId,
spiderX = node.spiderX, spiderX = node.spiderX,
show = false,
}; };
streamSettings.realitySettings = realitySettings; streamSettings.realitySettings = realitySettings;
@ -630,6 +631,25 @@ namespace v2rayN.Handler.CoreConfig
} }
streamSettings.httpupgradeSettings = httpupgradeSettings; streamSettings.httpupgradeSettings = httpupgradeSettings;
break;
//splithttp
case nameof(ETransport.splithttp):
SplithttpSettings4Ray splithttpSettings = new()
{
maxUploadSize = 1000000,
maxConcurrentUploads = 10
};
if (!Utils.IsNullOrEmpty(node.path))
{
splithttpSettings.path = node.path;
}
if (!Utils.IsNullOrEmpty(host))
{
splithttpSettings.host = host;
}
streamSettings.splithttpSettings = splithttpSettings;
break; break;
//h2 //h2
case nameof(ETransport.h2): case nameof(ETransport.h2):

View File

@ -81,6 +81,7 @@ namespace v2rayN.Handler.Fmt
case nameof(ETransport.ws): case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade): case nameof(ETransport.httpupgrade):
case nameof(ETransport.splithttp):
if (!Utils.IsNullOrEmpty(item.requestHost)) if (!Utils.IsNullOrEmpty(item.requestHost))
{ {
dicQuery.Add("host", Utils.UrlEncode(item.requestHost)); dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
@ -152,6 +153,7 @@ namespace v2rayN.Handler.Fmt
case nameof(ETransport.ws): case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade): case nameof(ETransport.httpupgrade):
case nameof(ETransport.splithttp):
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

@ -156,6 +156,7 @@ namespace v2rayN.Handler.Fmt
case nameof(ETransport.ws): case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade): case nameof(ETransport.httpupgrade):
case nameof(ETransport.splithttp):
string p1 = query["path"] ?? "/"; string p1 = query["path"] ?? "/";
string h1 = query["host"] ?? ""; string h1 = query["host"] ?? "";
item.requestHost = Utils.UrlDecode(h1); item.requestHost = Utils.UrlDecode(h1);

View File

@ -421,47 +421,52 @@ namespace v2rayN.Models
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public TlsSettings4Ray tlsSettings { get; set; } public TlsSettings4Ray? tlsSettings { get; set; }
/// <summary> /// <summary>
/// Tcp传输额外设置 /// Tcp传输额外设置
/// </summary> /// </summary>
public TcpSettings4Ray tcpSettings { get; set; } public TcpSettings4Ray? tcpSettings { get; set; }
/// <summary> /// <summary>
/// Kcp传输额外设置 /// Kcp传输额外设置
/// </summary> /// </summary>
public KcpSettings4Ray kcpSettings { get; set; } public KcpSettings4Ray? kcpSettings { get; set; }
/// <summary> /// <summary>
/// ws传输额外设置 /// ws传输额外设置
/// </summary> /// </summary>
public WsSettings4Ray wsSettings { get; set; } public WsSettings4Ray? wsSettings { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public HttpupgradeSettings4Ray? httpupgradeSettings { get; set; } public HttpupgradeSettings4Ray? httpupgradeSettings { get; set; }
/// <summary>
///
/// </summary>
public SplithttpSettings4Ray? splithttpSettings { get; set; }
/// <summary> /// <summary>
/// h2传输额外设置 /// h2传输额外设置
/// </summary> /// </summary>
public HttpSettings4Ray httpSettings { get; set; } public HttpSettings4Ray? httpSettings { get; set; }
/// <summary> /// <summary>
/// QUIC /// QUIC
/// </summary> /// </summary>
public QuicSettings4Ray quicSettings { get; set; } public QuicSettings4Ray? quicSettings { get; set; }
/// <summary> /// <summary>
/// VLESS only /// VLESS only
/// </summary> /// </summary>
public TlsSettings4Ray realitySettings { get; set; } public TlsSettings4Ray? realitySettings { get; set; }
/// <summary> /// <summary>
/// grpc /// grpc
/// </summary> /// </summary>
public GrpcSettings4Ray grpcSettings { get; set; } public GrpcSettings4Ray? grpcSettings { get; set; }
/// <summary> /// <summary>
/// sockopt /// sockopt
@ -488,7 +493,7 @@ namespace v2rayN.Models
public string? fingerprint { get; set; } public string? fingerprint { get; set; }
public bool? show { get; set; } = false; public bool? show { get; set; }
public string? publicKey { get; set; } public string? publicKey { get; set; }
public string? shortId { get; set; } public string? shortId { get; set; }
public string? spiderX { get; set; } public string? spiderX { get; set; }
@ -608,6 +613,17 @@ namespace v2rayN.Models
public string? host { get; set; } public string? host { get; set; }
} }
public class SplithttpSettings4Ray
{
public string? path { get; set; }
public string? host { get; set; }
public int? maxUploadSize { get; set; }
public int? maxConcurrentUploads { get; set; }
}
public class HttpSettings4Ray public class HttpSettings4Ray
{ {
/// <summary> /// <summary>

View File

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

View File

@ -359,7 +359,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 path</value> <value>*ws/httpupgrade/splithttp path</value>
</data> </data>
<data name="TransportPathTip2" xml:space="preserve"> <data name="TransportPathTip2" xml:space="preserve">
<value>*h2 path</value> <value>*h2 path</value>
@ -374,7 +374,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 host</value> <value>*ws/httpupgrade/splithttp 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

@ -359,7 +359,7 @@
<value>请填写正确的自定义DNS</value> <value>请填写正确的自定义DNS</value>
</data> </data>
<data name="TransportPathTip1" xml:space="preserve"> <data name="TransportPathTip1" xml:space="preserve">
<value>*ws/httpupgrade path</value> <value>*ws/httpupgrade/splithttp path</value>
</data> </data>
<data name="TransportPathTip2" xml:space="preserve"> <data name="TransportPathTip2" xml:space="preserve">
<value>*h2 path</value> <value>*h2 path</value>
@ -374,7 +374,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 host</value> <value>*ws/httpupgrade/splithttp 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

@ -358,7 +358,7 @@
<value>請填寫正確的自訂DNS</value> <value>請填寫正確的自訂DNS</value>
</data> </data>
<data name="TransportPathTip1" xml:space="preserve"> <data name="TransportPathTip1" xml:space="preserve">
<value>*ws/httpupgrade path</value> <value>*ws/httpupgrade/splithttp path</value>
</data> </data>
<data name="TransportPathTip2" xml:space="preserve"> <data name="TransportPathTip2" xml:space="preserve">
<value>*h2 path</value> <value>*h2 path</value>
@ -373,7 +373,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 host</value> <value>*ws/httpupgrade/splithttp 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

@ -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):
tipRequestHost.Text = ResUI.TransportRequestHostTip2; tipRequestHost.Text = ResUI.TransportRequestHostTip2;
tipPath.Text = ResUI.TransportPathTip1; tipPath.Text = ResUI.TransportPathTip1;
break; break;