diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index 7bb4df6e..e82a014a 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -156,7 +156,7 @@ namespace v2rayN 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", "h2", "quic", "grpc" }; + public static readonly List Networks = new() { "tcp", "kcp", "ws", "httpupgrade", "h2", "quic", "grpc" }; public static readonly List KcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" }; public static readonly List CoreTypes = new() { "v2fly", "SagerNet", "Xray", "sing_box" }; public static readonly List CoreTypes4VLESS = new() { "Xray", "sing_box" }; diff --git a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs index 209e6dea..2ec4385d 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs @@ -439,6 +439,12 @@ namespace v2rayN.Handler }; } break; + case nameof(ETransport.httpupgrade): + transport.type = nameof(ETransport.httpupgrade); + transport.path = Utile.IsNullOrEmpty(node.path) ? null : node.path; + transport.host = Utile.IsNullOrEmpty(node.requestHost) ? null : node.requestHost; + + break; case nameof(ETransport.quic): transport.type = nameof(ETransport.quic); diff --git a/v2rayN/v2rayN/Handler/CoreConfigV2ray.cs b/v2rayN/v2rayN/Handler/CoreConfigV2ray.cs index 5381e7be..93db1bc9 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigV2ray.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigV2ray.cs @@ -606,6 +606,21 @@ namespace v2rayN.Handler } streamSettings.wsSettings = wsSettings; + break; + //httpupgrade + case nameof(ETransport.httpupgrade): + HttpupgradeSettings4Ray httpupgradeSettings = new(); + + if (!string.IsNullOrWhiteSpace(node.path)) + { + httpupgradeSettings.path = node.path; + } + if (!string.IsNullOrWhiteSpace(host)) + { + httpupgradeSettings.host = host; + } + streamSettings.httpupgradeSettings = httpupgradeSettings; + break; //h2 case nameof(ETransport.h2): diff --git a/v2rayN/v2rayN/Handler/ShareHandler.cs b/v2rayN/v2rayN/Handler/ShareHandler.cs index c955fd32..1a3d85c1 100644 --- a/v2rayN/v2rayN/Handler/ShareHandler.cs +++ b/v2rayN/v2rayN/Handler/ShareHandler.cs @@ -331,6 +331,7 @@ namespace v2rayN.Handler break; case nameof(ETransport.ws): + case nameof(ETransport.httpupgrade): if (!Utile.IsNullOrEmpty(item.requestHost)) { dicQuery.Add("host", Utile.UrlEncode(item.requestHost)); @@ -609,6 +610,7 @@ namespace v2rayN.Handler break; case nameof(ETransport.ws): + case nameof(ETransport.httpupgrade): string p1 = query["path"] ?? "/"; string h1 = query["host"] ?? ""; i.requestHost = Utile.UrlDecode(h1); @@ -960,6 +962,7 @@ namespace v2rayN.Handler break; case nameof(ETransport.ws): + case nameof(ETransport.httpupgrade): item.requestHost = Utile.UrlDecode(query["host"] ?? ""); item.path = Utile.UrlDecode(query["path"] ?? "/"); break; diff --git a/v2rayN/v2rayN/Model/ETransport.cs b/v2rayN/v2rayN/Model/ETransport.cs index 0351aa52..922f35ae 100644 --- a/v2rayN/v2rayN/Model/ETransport.cs +++ b/v2rayN/v2rayN/Model/ETransport.cs @@ -5,6 +5,7 @@ tcp, kcp, ws, + httpupgrade, h2, http, quic, diff --git a/v2rayN/v2rayN/Model/SingboxConfig.cs b/v2rayN/v2rayN/Model/SingboxConfig.cs index 3b917832..1e46e24b 100644 --- a/v2rayN/v2rayN/Model/SingboxConfig.cs +++ b/v2rayN/v2rayN/Model/SingboxConfig.cs @@ -159,7 +159,7 @@ public class Transport4Sbox { public string? type { get; set; } - public List? host { get; set; } + public object? host { get; set; } public string? path { get; set; } public Headers4Sbox? headers { get; set; } diff --git a/v2rayN/v2rayN/Model/V2rayConfig.cs b/v2rayN/v2rayN/Model/V2rayConfig.cs index d526ed3a..7565f488 100644 --- a/v2rayN/v2rayN/Model/V2rayConfig.cs +++ b/v2rayN/v2rayN/Model/V2rayConfig.cs @@ -431,6 +431,11 @@ namespace v2rayN.Model /// public WsSettings4Ray wsSettings { get; set; } + /// + /// + /// + public HttpupgradeSettings4Ray? httpupgradeSettings { get; set; } + /// /// h2传输额外设置 /// @@ -582,6 +587,20 @@ namespace v2rayN.Model [JsonPropertyName("User-Agent")] public string UserAgent { get; set; } } + + + public class HttpupgradeSettings4Ray + { + /// + /// + /// + public string? path { get; set; } + + /// + /// + /// + public string? host { get; set; } + } public class HttpSettings4Ray { diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs index ce88c0c6..46b792cf 100644 --- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs +++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs @@ -3203,7 +3203,7 @@ namespace v2rayN.Resx { } /// - /// 查找类似 *ws path 的本地化字符串。 + /// 查找类似 *ws/httpupgrade path 的本地化字符串。 /// public static string TransportPathTip1 { get { @@ -3257,7 +3257,7 @@ namespace v2rayN.Resx { } /// - /// 查找类似 *ws host 的本地化字符串。 + /// 查找类似 *ws/httpupgrade host 的本地化字符串。 /// public static string TransportRequestHostTip2 { get { diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx index ead59ee3..12cdb236 100644 --- a/v2rayN/v2rayN/Resx/ResUI.resx +++ b/v2rayN/v2rayN/Resx/ResUI.resx @@ -359,7 +359,7 @@ Please fill in the correct custom DNS - *ws path + *ws/httpupgrade path *h2 path @@ -374,7 +374,7 @@ *http host Separated by commas (,) - *ws host + *ws/httpupgrade host *h2 host Separated by commas (,) diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx index a65fb73c..c694f7f2 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx @@ -359,7 +359,7 @@ 请填写正确的自定义DNS - *ws path + *ws/httpupgrade path *h2 path @@ -374,7 +374,7 @@ *http host中间逗号(,)分隔 - *ws host + *ws/httpupgrade host *h2 host中间逗号(,)分隔 diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx index 7ba2cce0..8b3e6ac2 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx @@ -358,7 +358,7 @@ 請填寫正確的自訂DNS - *ws path + *ws/httpupgrade path *h2 path @@ -373,7 +373,7 @@ *http host中間逗號(,)分隔 - *ws host + *ws/httpupgrade host *h2 host中間逗號(,)分隔 diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index c9c5c8ed..e79b2db3 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -279,7 +279,7 @@ namespace v2rayN.Views return; } - if (network == Global.DefaultNetwork) + if (network == nameof(ETransport.tcp)) { cmbHeaderType.Items.Add(Global.None); cmbHeaderType.Items.Add(Global.TcpHeaderHttp); @@ -329,6 +329,7 @@ namespace v2rayN.Views break; case nameof(ETransport.ws): + case nameof(ETransport.httpupgrade): tipRequestHost.Text = ResUI.TransportRequestHostTip2; tipPath.Text = ResUI.TransportPathTip1; break;