From 9d109e7ca9cc75013c3c299b01e954e293a14f7d Mon Sep 17 00:00:00 2001 From: mayampi01 <176286256+mayampi01@users.noreply.github.com> Date: Sat, 10 Aug 2024 19:21:47 +0800 Subject: [PATCH] Hardcode popular Android Private DNS rule to fix localhost DNS problem (#3433) * hardcode popular Android Private DNS rule to fix localhost DNS problem * V2rayConfigUtil.kt: Fix hosts type * hardcode popular Android Private DNS: Add dns.pub --- .../src/main/kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt index da572a7d..d8209ba6 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt @@ -423,7 +423,7 @@ object V2rayConfigUtil { private fun dns(v2rayConfig: V2rayConfig): Boolean { try { - val hosts = mutableMapOf() + val hosts = mutableMapOf() val servers = ArrayList() //remote Dns @@ -503,6 +503,12 @@ object V2rayConfigUtil { // hardcode googleapi rule to fix play store problems hosts["domain:googleapis.cn"] = "googleapis.com" + // hardcode popular Android Private DNS rule to fix localhost DNS problem + hosts["dns.pub"] = arrayListOf("1.12.12.12", "120.53.53.53") + hosts["dns.alidns.com"] = arrayListOf("223.5.5.5", "223.6.6.6", "2400:3200::1", "2400:3200:baba::1") + hosts["one.one.one.one"] = arrayListOf("1.1.1.1", "1.0.0.1", "2606:4700:4700::1111", "2606:4700:4700::1001") + hosts["dns.google"] = arrayListOf("8.8.8.8", "8.8.4.4", "2001:4860:4860::8888", "2001:4860:4860::8844") + // DNS dns对象 v2rayConfig.dns = V2rayConfig.DnsBean( servers = servers,