mirror of
https://github.com/2dust/v2rayN.git
synced 2026-04-14 19:45:45 +00:00
Compare commits
3 commits
6da9caf6ba
...
63f114bbc4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63f114bbc4 | ||
|
|
495b5db4f1 | ||
|
|
dea143b20d |
11 changed files with 38 additions and 16 deletions
|
|
@ -189,7 +189,8 @@ public class Global
|
||||||
{"safari","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15" },
|
{"safari","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15" },
|
||||||
{"edge","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.70" },
|
{"edge","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.70" },
|
||||||
{"none",""},
|
{"none",""},
|
||||||
{"golang",""}
|
{"golang","Go-http-client/1.1"},
|
||||||
|
{"curl","curl/7.68.0"},
|
||||||
};
|
};
|
||||||
|
|
||||||
public const string Hysteria2ProtocolShare = "hy2://";
|
public const string Hysteria2ProtocolShare = "hy2://";
|
||||||
|
|
@ -393,7 +394,8 @@ public class Global
|
||||||
"chrome",
|
"chrome",
|
||||||
"firefox",
|
"firefox",
|
||||||
"edge",
|
"edge",
|
||||||
"golang"
|
"curl",
|
||||||
|
"golang",
|
||||||
];
|
];
|
||||||
|
|
||||||
public static readonly List<string> XhttpMode =
|
public static readonly List<string> XhttpMode =
|
||||||
|
|
@ -424,11 +426,12 @@ public class Global
|
||||||
|
|
||||||
public static readonly List<string> DomainDirectDNSAddress =
|
public static readonly List<string> DomainDirectDNSAddress =
|
||||||
[
|
[
|
||||||
"https://dns.alidns.com/dns-query",
|
|
||||||
"https://doh.pub/dns-query",
|
|
||||||
"https://dns.alidns.com/dns-query,https://doh.pub/dns-query",
|
|
||||||
"223.5.5.5",
|
|
||||||
"119.29.29.29",
|
"119.29.29.29",
|
||||||
|
"223.5.5.5",
|
||||||
|
"119.29.29.29,223.5.5.5,https://doh.pub/dns-query",
|
||||||
|
"https://doh.pub/dns-query",
|
||||||
|
"https://dns.alidns.com/dns-query",
|
||||||
|
"https://doh.pub/dns-query,https://dns.alidns.com/dns-query",
|
||||||
"localhost"
|
"localhost"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -440,7 +443,7 @@ public class Global
|
||||||
"https://dns.cloudflare.com/dns-query",
|
"https://dns.cloudflare.com/dns-query",
|
||||||
"https://doh.dns.sb/dns-query",
|
"https://doh.dns.sb/dns-query",
|
||||||
"https://doh.opendns.com/dns-query",
|
"https://doh.opendns.com/dns-query",
|
||||||
"https://common.dot.dns.yandex.net",
|
"https://common.dot.dns.yandex.net/dns-query",
|
||||||
"8.8.8.8",
|
"8.8.8.8",
|
||||||
"1.1.1.1",
|
"1.1.1.1",
|
||||||
"185.222.222.222",
|
"185.222.222.222",
|
||||||
|
|
@ -450,8 +453,8 @@ public class Global
|
||||||
|
|
||||||
public static readonly List<string> DomainPureIPDNSAddress =
|
public static readonly List<string> DomainPureIPDNSAddress =
|
||||||
[
|
[
|
||||||
"223.5.5.5",
|
|
||||||
"119.29.29.29",
|
"119.29.29.29",
|
||||||
|
"223.5.5.5",
|
||||||
"localhost"
|
"localhost"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,8 @@ public class Transport4Sbox
|
||||||
public class Headers4Sbox
|
public class Headers4Sbox
|
||||||
{
|
{
|
||||||
public string? Host { get; set; }
|
public string? Host { get; set; }
|
||||||
|
[JsonPropertyName("User-Agent")]
|
||||||
|
public string UserAgent { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HyObfs4Sbox
|
public class HyObfs4Sbox
|
||||||
|
|
|
||||||
2
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
2
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
|
|
@ -3772,7 +3772,7 @@ namespace ServiceLib.Resx {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 This parameter is valid only for tcp/http and ws 的本地化字符串。
|
/// 查找类似 This parameter is valid only for tcp/http, ws, gRPC and xhttp 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string TbSettingsDefUserAgentTips {
|
public static string TbSettingsDefUserAgentTips {
|
||||||
get {
|
get {
|
||||||
|
|
|
||||||
|
|
@ -937,7 +937,7 @@
|
||||||
<value>User-Agent</value>
|
<value>User-Agent</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
||||||
<value>این پارامتر فقط برای tcp/http و ws معتبر است</value>
|
<value>This parameter is valid only for tcp/http, ws, gRPC and xhttp</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
||||||
<value>FontFamily (نیاز به راه اندازی مجدد)</value>
|
<value>FontFamily (نیاز به راه اندازی مجدد)</value>
|
||||||
|
|
|
||||||
|
|
@ -937,7 +937,7 @@
|
||||||
<value>Agent utilisateur (User-Agent)</value>
|
<value>Agent utilisateur (User-Agent)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
||||||
<value>Valable uniquement pour les protocoles tcp/http et ws</value>
|
<value>This parameter is valid only for tcp/http, ws, gRPC and xhttp</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
||||||
<value>Police actuelle (redémarrage requis)</value>
|
<value>Police actuelle (redémarrage requis)</value>
|
||||||
|
|
|
||||||
|
|
@ -937,7 +937,7 @@
|
||||||
<value>User-Agent</value>
|
<value>User-Agent</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
||||||
<value>Ez a paraméter csak tcp/http és ws esetén érvényes</value>
|
<value>This parameter is valid only for tcp/http, ws, gRPC and xhttp</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
||||||
<value>Betűtípus (újraindítást igényel)</value>
|
<value>Betűtípus (újraindítást igényel)</value>
|
||||||
|
|
|
||||||
|
|
@ -937,7 +937,7 @@
|
||||||
<value>User-Agent</value>
|
<value>User-Agent</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
||||||
<value>This parameter is valid only for tcp/http and ws</value>
|
<value>This parameter is valid only for tcp/http, ws, gRPC and xhttp</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
||||||
<value>Font family (requires restart)</value>
|
<value>Font family (requires restart)</value>
|
||||||
|
|
|
||||||
|
|
@ -937,7 +937,7 @@
|
||||||
<value>User-Agent</value>
|
<value>User-Agent</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
||||||
<value>Параметр действует только для TCP/HTTP и WebSocket (WS)</value>
|
<value>This parameter is valid only for tcp/http, ws, gRPC and xhttp</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
||||||
<value>Шрифт (требуется перезапуск)</value>
|
<value>Шрифт (требуется перезапуск)</value>
|
||||||
|
|
|
||||||
|
|
@ -937,7 +937,7 @@
|
||||||
<value>用户代理 (User-Agent)</value>
|
<value>用户代理 (User-Agent)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
||||||
<value>仅对 tcp/http、ws 协议生效</value>
|
<value>仅对 tcp/http、ws、gRPC、xhttp 生效</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
||||||
<value>当前字体 (需重启)</value>
|
<value>当前字体 (需重启)</value>
|
||||||
|
|
|
||||||
|
|
@ -937,7 +937,7 @@
|
||||||
<value>使用者代理 (User-Agent)</value>
|
<value>使用者代理 (User-Agent)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
<data name="TbSettingsDefUserAgentTips" xml:space="preserve">
|
||||||
<value>僅對 TCP/HTTP、WS 協定生效</value>
|
<value>僅對 TCP/HTTP、WS、gRPC、XHTTP 生效</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
<data name="TbSettingsCurrentFontFamily" xml:space="preserve">
|
||||||
<value>目前字型 (需重啟)</value>
|
<value>目前字型 (需重啟)</value>
|
||||||
|
|
|
||||||
|
|
@ -438,6 +438,8 @@ public partial class CoreConfigSingboxService
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var transport = new Transport4Sbox();
|
var transport = new Transport4Sbox();
|
||||||
|
var useragent = _config.CoreBasicItem.DefUserAgent ?? string.Empty;
|
||||||
|
var useragentValue = Global.TcpHttpUserAgentTexts.GetValueOrDefault(useragent, useragent);
|
||||||
|
|
||||||
switch (_node.GetNetwork())
|
switch (_node.GetNetwork())
|
||||||
{
|
{
|
||||||
|
|
@ -453,6 +455,11 @@ public partial class CoreConfigSingboxService
|
||||||
transport.type = nameof(ETransport.http);
|
transport.type = nameof(ETransport.http);
|
||||||
transport.host = _node.RequestHost.IsNullOrEmpty() ? null : Utils.String2List(_node.RequestHost);
|
transport.host = _node.RequestHost.IsNullOrEmpty() ? null : Utils.String2List(_node.RequestHost);
|
||||||
transport.path = _node.Path.NullIfEmpty();
|
transport.path = _node.Path.NullIfEmpty();
|
||||||
|
if (!useragentValue.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
transport.headers ??= new();
|
||||||
|
transport.headers.UserAgent = useragentValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -494,12 +501,22 @@ public partial class CoreConfigSingboxService
|
||||||
Host = _node.RequestHost
|
Host = _node.RequestHost
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (!useragentValue.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
transport.headers ??= new();
|
||||||
|
transport.headers.UserAgent = useragentValue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nameof(ETransport.httpupgrade):
|
case nameof(ETransport.httpupgrade):
|
||||||
transport.type = nameof(ETransport.httpupgrade);
|
transport.type = nameof(ETransport.httpupgrade);
|
||||||
transport.path = _node.Path.NullIfEmpty();
|
transport.path = _node.Path.NullIfEmpty();
|
||||||
transport.host = _node.RequestHost.NullIfEmpty();
|
transport.host = _node.RequestHost.NullIfEmpty();
|
||||||
|
if (!useragentValue.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
transport.headers ??= new();
|
||||||
|
transport.headers.UserAgent = useragentValue;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue