diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs
index a7c74c08..eb24d71e 100644
--- a/v2rayN/ServiceLib/Global.cs
+++ b/v2rayN/ServiceLib/Global.cs
@@ -40,6 +40,7 @@ public class Global
public const string ProxySetLinuxShellFileName = NamespaceSample + "proxy_set_linux_sh";
public const string KillAsSudoOSXShellFileName = NamespaceSample + "kill_as_sudo_osx_sh";
public const string KillAsSudoLinuxShellFileName = NamespaceSample + "kill_as_sudo_linux_sh";
+ public const string SingboxFakeIPFilterFileName = NamespaceSample + "singbox_fakeip_filter";
public const string DefaultSecurity = "auto";
public const string DefaultNetwork = "tcp";
diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
index e488720f..786f3aff 100644
--- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs
+++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
@@ -113,6 +113,10 @@ public static class ConfigHandler
config.ConstItem ??= new ConstItem();
config.SimpleDNSItem ??= InitBuiltinSimpleDNS();
+ if (config.SimpleDNSItem.GlobalFakeIp is null)
+ {
+ config.SimpleDNSItem.GlobalFakeIp = true;
+ }
config.SpeedTestItem ??= new();
if (config.SpeedTestItem.SpeedTestTimeout < 10)
@@ -2221,6 +2225,7 @@ public static class ConfigHandler
UseSystemHosts = false,
AddCommonHosts = true,
FakeIP = false,
+ GlobalFakeIp = true,
BlockBindingQuery = true,
DirectDNS = Global.DomainDirectDNSAddress.FirstOrDefault(),
RemoteDNS = Global.DomainRemoteDNSAddress.FirstOrDefault(),
diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs
index 148f2bd7..b9b305bb 100644
--- a/v2rayN/ServiceLib/Models/ConfigItems.cs
+++ b/v2rayN/ServiceLib/Models/ConfigItems.cs
@@ -260,6 +260,7 @@ public class SimpleDNSItem
public bool? UseSystemHosts { get; set; }
public bool? AddCommonHosts { get; set; }
public bool? FakeIP { get; set; }
+ public bool? GlobalFakeIp { get; set; }
public bool? BlockBindingQuery { get; set; }
public string? DirectDNS { get; set; }
public string? RemoteDNS { get; set; }
diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
index 6503b41c..7e848cf0 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
+++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
@@ -2301,15 +2301,6 @@ namespace ServiceLib.Resx {
}
}
- ///
- /// 查找类似 Apply to Proxy Domains Only 的本地化字符串。
- ///
- public static string TbApplyProxyDomainsOnly {
- get {
- return ResourceManager.GetString("TbApplyProxyDomainsOnly", resourceCulture);
- }
- }
-
///
/// 查找类似 Auto refresh 的本地化字符串。
///
@@ -2526,6 +2517,15 @@ namespace ServiceLib.Resx {
}
}
+ ///
+ /// 查找类似 Applies globally by default, with built-in FakeIP filtering (sing-box only). 的本地化字符串。
+ ///
+ public static string TbFakeIPTips {
+ get {
+ return ResourceManager.GetString("TbFakeIPTips", resourceCulture);
+ }
+ }
+
///
/// 查找类似 Fingerprint 的本地化字符串。
///
diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
index 0c8ca393..f79901eb 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
@@ -1455,9 +1455,6 @@
DNS Hosts: ("domain1 ip1 ip2" per line)
-
- Apply to Proxy Domains Only
-
Basic DNS Settings
@@ -1515,4 +1512,7 @@
Select Profile
+
+ Applies globally by default, with built-in FakeIP filtering (sing-box only).
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
index 800fa00f..e801c796 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
@@ -1455,9 +1455,6 @@
DNS Hosts: ("domain1 ip1 ip2" per line)
-
- Apply to Proxy Domains Only
-
Basic DNS Settings
@@ -1515,4 +1512,7 @@
Select Profile
+
+ Applies globally by default, with built-in FakeIP filtering (sing-box only).
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx
index 614c8092..fc4b218f 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.resx
@@ -1455,9 +1455,6 @@
DNS Hosts: ("domain1 ip1 ip2" per line)
-
- Apply to Proxy Domains Only
-
Basic DNS Settings
@@ -1515,4 +1512,7 @@
Select Profile
+
+ Applies globally by default, with built-in FakeIP filtering (sing-box only).
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
index 294d9f34..04e16eb8 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
@@ -1455,9 +1455,6 @@
DNS hosts: (каждая строка в формате "domain1 ip1 ip2")
-
- Применять только к доменам через прокси
-
Базовые настройки DNS
@@ -1515,4 +1512,7 @@
Select Profile
+
+ Applies globally by default, with built-in FakeIP filtering (sing-box only).
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
index 194a59e2..ced2d74b 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
@@ -1452,9 +1452,6 @@
DNS Hosts:(“域名1 ip1 ip2” 一行一个)
-
- 仅对代理域名生效
-
DNS 基础设置
@@ -1512,4 +1509,7 @@
选择配置文件
+
+ 默认全局生效,内置 FakeIP 过滤,仅在 sing-box 中生效
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
index fa84c789..720b7269 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
@@ -1452,9 +1452,6 @@
DNS Hosts: ("domain1 ip1 ip2" per line)
-
- Apply to Proxy Domains Only
-
Basic DNS Settings
@@ -1512,4 +1509,7 @@
Select Profile
+
+ Applies globally by default, with built-in FakeIP filtering (sing-box only).
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Sample/singbox_fakeip_filter b/v2rayN/ServiceLib/Sample/singbox_fakeip_filter
new file mode 100644
index 00000000..860ab0eb
--- /dev/null
+++ b/v2rayN/ServiceLib/Sample/singbox_fakeip_filter
@@ -0,0 +1,92 @@
+{
+ "domain": [
+ "amobile.music.tc.qq.com",
+ "api-jooxtt.sanook.com",
+ "api.joox.com",
+ "aqqmusic.tc.qq.com",
+ "dl.stream.qqmusic.qq.com",
+ "ff.dorado.sdo.com",
+ "heartbeat.belkin.com",
+ "isure.stream.qqmusic.qq.com",
+ "joox.com",
+ "lens.l.google.com",
+ "localhost.ptlogin2.qq.com",
+ "localhost.sec.qq.com",
+ "mesu.apple.com",
+ "mobileoc.music.tc.qq.com",
+ "music.taihe.com",
+ "musicapi.taihe.com",
+ "na.b.g-tun.com",
+ "proxy.golang.org",
+ "ps.res.netease.com",
+ "shark007.net",
+ "songsearch.kugou.com",
+ "static.adtidy.org",
+ "streamoc.music.tc.qq.com",
+ "swcdn.apple.com",
+ "swdist.apple.com",
+ "swdownload.apple.com",
+ "swquery.apple.com",
+ "swscan.apple.com",
+ "trackercdn.kugou.com",
+ "xnotify.xboxlive.com"
+ ],
+ "domain_keyword": [
+ "ntp",
+ "stun",
+ "time"
+ ],
+ "domain_regex": [
+ "^[^.]+$",
+ "^[^.]+\\.[^.]+\\.xboxlive\\.com$",
+ "^localhost\\.[^.]+\\.weixin\\.qq\\.com$",
+ "^mijia\\scloud$",
+ "^xbox\\.[^.]+\\.microsoft\\.com$",
+ "^xbox\\.[^.]+\\.[^.]+\\.microsoft\\.com$"
+ ],
+ "domain_suffix": [
+ "126.net",
+ "3gppnetwork.org",
+ "battle.net",
+ "battlenet.com.cn",
+ "cdn.nintendo.net",
+ "cmbchina.com",
+ "cmbimg.com",
+ "ff14.sdo.com",
+ "ffxiv.com",
+ "finalfantasyxiv.com",
+ "gcloudcs.com",
+ "home.arpa",
+ "invalid",
+ "kuwo.cn",
+ "lan",
+ "linksys.com",
+ "linksyssmartwifi.com",
+ "local",
+ "localdomain",
+ "localhost",
+ "market.xiaomi.com",
+ "mcdn.bilivideo.cn",
+ "media.dssott.com",
+ "msftconnecttest.com",
+ "msftncsi.com",
+ "music.163.com",
+ "music.migu.cn",
+ "n0808.com",
+ "nflxvideo.net",
+ "oray.com",
+ "orayimg.com",
+ "router.asus.com",
+ "sandai.net",
+ "square-enix.com",
+ "srv.nintendo.net",
+ "steamcontent.com",
+ "uu.163.com",
+ "wargaming.net",
+ "wggames.cn",
+ "wotgame.cn",
+ "wowsgame.cn",
+ "xiami.com",
+ "y.qq.com"
+ ]
+}
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/ServiceLib.csproj b/v2rayN/ServiceLib/ServiceLib.csproj
index ecbab780..7ee72196 100644
--- a/v2rayN/ServiceLib/ServiceLib.csproj
+++ b/v2rayN/ServiceLib/ServiceLib.csproj
@@ -44,6 +44,7 @@
+
diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs
index 306572a1..00bb14d9 100644
--- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs
+++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs
@@ -33,6 +33,15 @@ public partial class CoreConfigSingboxService
lastRule.Ip?.Contains("0.0.0.0/0") == true);
}
singboxConfig.dns.final = useDirectDns ? Global.SingboxDirectDNSTag : Global.SingboxRemoteDNSTag;
+ if ((!useDirectDns) && simpleDNSItem.FakeIP == true && simpleDNSItem.GlobalFakeIp == false)
+ {
+ singboxConfig.dns.rules.Add(new()
+ {
+ server = Global.SingboxFakeDNSTag,
+ query_type = new List { 1, 28 }, // A and AAAA
+ rewrite_ttl = 1,
+ });
+ }
// Tun2SocksAddress
if (node != null && Utils.IsDomain(node.Address))
@@ -187,6 +196,28 @@ public partial class CoreConfigSingboxService
});
}
+ if (simpleDNSItem.FakeIP == true && simpleDNSItem.GlobalFakeIp == true)
+ {
+ var fakeipFilterRule = JsonUtils.Deserialize(EmbedUtils.GetEmbedText(Global.SingboxFakeIPFilterFileName));
+ fakeipFilterRule.invert = true;
+ var rule4Fake = new Rule4Sbox
+ {
+ server = Global.SingboxFakeDNSTag,
+ type = "logical",
+ mode = "and",
+ rewrite_ttl = 1,
+ rules = new List
+ {
+ new() {
+ query_type = new List { 1, 28 }, // A and AAAA
+ },
+ fakeipFilterRule,
+ }
+ };
+
+ singboxConfig.dns.rules.Add(rule4Fake);
+ }
+
var routing = await ConfigHandler.GetDefaultRouting(_config);
if (routing == null)
return 0;
@@ -266,10 +297,12 @@ public partial class CoreConfigSingboxService
}
else
{
- if (simpleDNSItem.FakeIP == true)
+ if (simpleDNSItem.FakeIP == true && simpleDNSItem.GlobalFakeIp == false)
{
var rule4Fake = JsonUtils.DeepCopy(rule);
rule4Fake.server = Global.SingboxFakeDNSTag;
+ rule4Fake.query_type = new List { 1, 28 }; // A and AAAA
+ rule4Fake.rewrite_ttl = 1;
singboxConfig.dns.rules.Add(rule4Fake);
}
rule.server = Global.SingboxRemoteDNSTag;
diff --git a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml
index 18f294d3..d8eed12e 100644
--- a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml
@@ -229,7 +229,7 @@
Grid.Column="2"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
- Text="{x:Static resx:ResUI.TbApplyProxyDomainsOnly}"
+ Text="{x:Static resx:ResUI.TbFakeIPTips}"
TextWrapping="Wrap" />