2dust 1 week ago
parent
commit
d781c768e9
  1. 7
      v2rayN/ServiceLib/Global.cs
  2. 19
      v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs
  3. 1
      v2rayN/ServiceLib/Models/V2rayConfig.cs
  4. 9
      v2rayN/ServiceLib/Resx/ResUI.Designer.cs
  5. 3
      v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
  6. 3
      v2rayN/ServiceLib/Resx/ResUI.resx
  7. 3
      v2rayN/ServiceLib/Resx/ResUI.ru.resx
  8. 3
      v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
  9. 3
      v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
  10. 5
      v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs
  11. 13
      v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml.cs
  12. 13
      v2rayN/v2rayN/Views/AddServerWindow.xaml.cs

7
v2rayN/ServiceLib/Global.cs

@ -187,6 +187,7 @@
public static readonly List<string> DomainMatchers = new() { "linear", "mph", "" };
public static readonly List<string> Fingerprints = new() { "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized", "" };
public static readonly List<string> UserAgent = new() { "chrome", "firefox", "safari", "edge", "none" };
public static readonly List<string> XhttpMode = new() { "auto", "packet-up", "stream-up" };
public static readonly List<string> AllowInsecure = new() { "true", "false", "" };
public static readonly List<string> DomainStrategy4Freedoms = new() { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" };
@ -206,9 +207,9 @@
public static readonly List<string> SingboxMuxs = new() { "h2mux", "smux", "yamux", "" };
public static readonly List<string> TuicCongestionControls = new() { "cubic", "new_reno", "bbr" };
public static readonly List<string> allowSelectType = new List<string> { "selector", "urltest", "loadbalance", "fallback" };
public static readonly List<string> notAllowTestType = new List<string> { "selector", "urltest", "direct", "reject", "compatible", "pass", "loadbalance", "fallback" };
public static readonly List<string> proxyVehicleType = new List<string> { "file", "http" };
public static readonly List<string> allowSelectType = new() { "selector", "urltest", "loadbalance", "fallback" };
public static readonly List<string> notAllowTestType = new() { "selector", "urltest", "direct", "reject", "compatible", "pass", "loadbalance", "fallback" };
public static readonly List<string> proxyVehicleType = new() { "file", "http" };
#endregion const
}

19
v2rayN/ServiceLib/Handler/Fmt/BaseFmt.cs

@ -83,6 +83,16 @@ namespace ServiceLib.Handler.Fmt
case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade):
if (Utils.IsNotEmpty(item.RequestHost))
{
dicQuery.Add("host", Utils.UrlEncode(item.RequestHost));
}
if (Utils.IsNotEmpty(item.Path))
{
dicQuery.Add("path", Utils.UrlEncode(item.Path));
}
break;
case nameof(ETransport.splithttp):
case nameof(ETransport.xhttp):
if (Utils.IsNotEmpty(item.RequestHost))
@ -93,6 +103,10 @@ namespace ServiceLib.Handler.Fmt
{
dicQuery.Add("path", Utils.UrlEncode(item.Path));
}
if (Utils.IsNotEmpty(item.HeaderType) && Global.XhttpMode.Contains(item.HeaderType))
{
dicQuery.Add("mode", Utils.UrlEncode(item.HeaderType));
}
break;
case nameof(ETransport.http):
@ -157,10 +171,15 @@ namespace ServiceLib.Handler.Fmt
case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade):
item.RequestHost = Utils.UrlDecode(query["host"] ?? "");
item.Path = Utils.UrlDecode(query["path"] ?? "/");
break;
case nameof(ETransport.splithttp):
case nameof(ETransport.xhttp):
item.RequestHost = Utils.UrlDecode(query["host"] ?? "");
item.Path = Utils.UrlDecode(query["path"] ?? "/");
item.HeaderType = Utils.UrlDecode(query["mode"] ?? "");
break;
case nameof(ETransport.http):

1
v2rayN/ServiceLib/Models/V2rayConfig.cs

@ -348,6 +348,7 @@ namespace ServiceLib.Models
{
public string? path { get; set; }
public string? host { get; set; }
public string? mode { get; set; }
public string? scMaxEachPostBytes { get; set; }
public string? scMaxConcurrentPosts { get; set; }
public string? scMinPostsIntervalMs { get; set; }

9
v2rayN/ServiceLib/Resx/ResUI.Designer.cs generated

@ -3733,6 +3733,15 @@ namespace ServiceLib.Resx {
}
}
/// <summary>
/// 查找类似 *xhttp mode 的本地化字符串。
/// </summary>
public static string TransportHeaderTypeTip5 {
get {
return ResourceManager.GetString("TransportHeaderTypeTip5", resourceCulture);
}
}
/// <summary>
/// 查找类似 *ws/httpupgrade/xhttp path 的本地化字符串。
/// </summary>

3
v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx

@ -1381,4 +1381,7 @@
<data name="TbSettingsLinuxSudoPasswordNotSudoRunApp" xml:space="preserve">
<value>Please do not run this app with sudo</value>
</data>
<data name="TransportHeaderTypeTip5" xml:space="preserve">
<value>*xhttp mode</value>
</data>
</root>

3
v2rayN/ServiceLib/Resx/ResUI.resx

@ -1381,4 +1381,7 @@
<data name="TbSettingsLinuxSudoPasswordNotSudoRunApp" xml:space="preserve">
<value>Please do not run this app with sudo</value>
</data>
<data name="TransportHeaderTypeTip5" xml:space="preserve">
<value>*xhttp mode</value>
</data>
</root>

3
v2rayN/ServiceLib/Resx/ResUI.ru.resx

@ -1381,4 +1381,7 @@
<data name="TbSettingsLinuxSudoPasswordNotSudoRunApp" xml:space="preserve">
<value>Please do not run this app with sudo</value>
</data>
<data name="TransportHeaderTypeTip5" xml:space="preserve">
<value>*xhttp mode</value>
</data>
</root>

3
v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx

@ -1378,4 +1378,7 @@
<data name="TbSettingsLinuxSudoPasswordNotSudoRunApp" xml:space="preserve">
<value>请不要用sudo运行本app</value>
</data>
<data name="TransportHeaderTypeTip5" xml:space="preserve">
<value>*xhttp 模式</value>
</data>
</root>

3
v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx

@ -1378,4 +1378,7 @@
<data name="TbSettingsLinuxSudoPasswordNotSudoRunApp" xml:space="preserve">
<value>請不要用sudo來運行本app</value>
</data>
<data name="TransportHeaderTypeTip5" xml:space="preserve">
<value>*xhttp 模式</value>
</data>
</root>

5
v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs

@ -945,6 +945,11 @@ namespace ServiceLib.Services.CoreConfig
{
xhttpSettings.host = host;
}
if (Utils.IsNotEmpty(node.HeaderType) && Global.XhttpMode.Contains(node.HeaderType))
{
xhttpSettings.mode = node.HeaderType;
}
streamSettings.xhttpSettings = xhttpSettings;
break;

13
v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml.cs

@ -299,6 +299,13 @@ namespace v2rayN.Desktop.Views
cmbHeaderType.Items.Add(it);
});
}
else if (network is nameof(ETransport.splithttp) or nameof(ETransport.xhttp))
{
Global.XhttpMode.ForEach(it =>
{
cmbHeaderType.Items.Add(it);
});
}
else if (network == nameof(ETransport.grpc))
{
cmbHeaderType.Items.Add(Global.GrpcGunMode);
@ -337,10 +344,16 @@ namespace v2rayN.Desktop.Views
case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade):
tipRequestHost.Text = ResUI.TransportRequestHostTip2;
tipPath.Text = ResUI.TransportPathTip1;
break;
case nameof(ETransport.splithttp):
case nameof(ETransport.xhttp):
tipRequestHost.Text = ResUI.TransportRequestHostTip2;
tipPath.Text = ResUI.TransportPathTip1;
tipHeaderType.Text = ResUI.TransportHeaderTypeTip5;
labHeaderType.IsVisible = false;
break;
case nameof(ETransport.h2):

13
v2rayN/v2rayN/Views/AddServerWindow.xaml.cs

@ -294,6 +294,13 @@ namespace v2rayN.Views
cmbHeaderType.Items.Add(it);
});
}
else if (network is nameof(ETransport.splithttp) or nameof(ETransport.xhttp))
{
Global.XhttpMode.ForEach(it =>
{
cmbHeaderType.Items.Add(it);
});
}
else if (network == nameof(ETransport.grpc))
{
cmbHeaderType.Items.Add(Global.GrpcGunMode);
@ -332,10 +339,16 @@ namespace v2rayN.Views
case nameof(ETransport.ws):
case nameof(ETransport.httpupgrade):
tipRequestHost.Text = ResUI.TransportRequestHostTip2;
tipPath.Text = ResUI.TransportPathTip1;
break;
case nameof(ETransport.splithttp):
case nameof(ETransport.xhttp):
tipRequestHost.Text = ResUI.TransportRequestHostTip2;
tipPath.Text = ResUI.TransportPathTip1;
tipHeaderType.Text = ResUI.TransportHeaderTypeTip5;
labHeaderType.Visibility = Visibility.Hidden;
break;
case nameof(ETransport.h2):

Loading…
Cancel
Save