diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/AppConfig.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/AppConfig.kt index 8f54e3db..b09954ee 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/AppConfig.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/AppConfig.kt @@ -91,6 +91,8 @@ object AppConfig { const val TAG_DIRECT = "direct" const val TAG_BLOCKED = "block" const val TAG_FRAGMENT = "fragment" + const val TAG_DNS = "dns-module" + const val TAG_DOMESTIC_DNS = "domestic-dns" /** Network-related constants. */ const val UPLINK = "uplink" diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/dto/V2rayConfig.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/dto/V2rayConfig.kt index 9aa161ec..80db57f7 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/dto/V2rayConfig.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/dto/V2rayConfig.kt @@ -490,6 +490,7 @@ data class V2rayConfig( var expectIPs: List? = null, val clientIp: String? = null, val skipFallback: Boolean? = null, + val tag: String? = null, ) } diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/handler/V2rayConfigManager.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/handler/V2rayConfigManager.kt index ed2db36a..27b81e4d 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/handler/V2rayConfigManager.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/handler/V2rayConfigManager.kt @@ -574,18 +574,8 @@ object V2rayConfigManager { address = domesticDns.first(), domains = directDomain, expectIPs = if (isCnRoutingMode) geoipCn else null, - skipFallback = true - ) - ) - } - - if (Utils.isPureIpAddress(domesticDns.first())) { - v2rayConfig.routing.rules.add( - 0, RulesBean( - outboundTag = AppConfig.TAG_DIRECT, - port = "53", - ip = arrayListOf(domesticDns.first()), - domain = null + skipFallback = true, + tag = AppConfig.TAG_DOMESTIC_DNS ) ) } @@ -626,20 +616,26 @@ object V2rayConfigManager { // DNS dns v2rayConfig.dns = V2rayConfig.DnsBean( servers = servers, - hosts = hosts + hosts = hosts, + tag = AppConfig.TAG_DNS ) // DNS routing - if (Utils.isPureIpAddress(remoteDns.first())) { - v2rayConfig.routing.rules.add( - 0, RulesBean( - outboundTag = AppConfig.TAG_PROXY, - port = "53", - ip = arrayListOf(remoteDns.first()), - domain = null - ) + v2rayConfig.routing.rules.add( + 0, RulesBean( + outboundTag = AppConfig.TAG_PROXY, + inboundTag = arrayListOf(AppConfig.TAG_DNS), + domain = null ) - } + ) + + v2rayConfig.routing.rules.add( + 0, RulesBean( + outboundTag = AppConfig.TAG_DIRECT, + inboundTag = arrayListOf(AppConfig.TAG_DOMESTIC_DNS), + domain = null + ) + ) } catch (e: Exception) { Log.e(AppConfig.TAG, "Failed to configure DNS", e) return false diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/ui/MainActivity.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/ui/MainActivity.kt index 7690b97c..bc619cf4 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/ui/MainActivity.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/ui/MainActivity.kt @@ -386,6 +386,9 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList } R.id.intelligent_selection_all -> { + if (MmkvManager.decodeSettingsString(AppConfig.PREF_OUTBOUND_DOMAIN_RESOLVE_METHOD, "1") != "0") { + toast(getString(R.string.pre_resolving_domain)) + } mainViewModel.createIntelligentSelectionAll() true } diff --git a/V2rayNG/app/src/main/res/values-ar/strings.xml b/V2rayNG/app/src/main/res/values-ar/strings.xml index bb50c08a..568324ee 100644 --- a/V2rayNG/app/src/main/res/values-ar/strings.xml +++ b/V2rayNG/app/src/main/res/values-ar/strings.xml @@ -377,5 +377,6 @@ Least Ping Least Load + Pre-resolving domain… diff --git a/V2rayNG/app/src/main/res/values-bn/strings.xml b/V2rayNG/app/src/main/res/values-bn/strings.xml index 53593a32..5ef3e7f8 100644 --- a/V2rayNG/app/src/main/res/values-bn/strings.xml +++ b/V2rayNG/app/src/main/res/values-bn/strings.xml @@ -382,5 +382,6 @@ Least Ping Least Load + Pre-resolving domain… \ No newline at end of file diff --git a/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml b/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml index 7a2dd4d6..7fce5e44 100644 --- a/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml +++ b/V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml @@ -392,5 +392,6 @@ کم ترین پینگ کم ترین بار(لود) + Pre-resolving domain… diff --git a/V2rayNG/app/src/main/res/values-fa/strings.xml b/V2rayNG/app/src/main/res/values-fa/strings.xml index 0d19dbcd..7d58e1ae 100644 --- a/V2rayNG/app/src/main/res/values-fa/strings.xml +++ b/V2rayNG/app/src/main/res/values-fa/strings.xml @@ -391,5 +391,6 @@ کمترین پینگ کمترین بار(لود) + Pre-resolving domain… diff --git a/V2rayNG/app/src/main/res/values-ru/strings.xml b/V2rayNG/app/src/main/res/values-ru/strings.xml index d838466a..e7004069 100644 --- a/V2rayNG/app/src/main/res/values-ru/strings.xml +++ b/V2rayNG/app/src/main/res/values-ru/strings.xml @@ -391,5 +391,6 @@ Наименьшая задержка Наименьшая нагрузка + Pre-resolving domain… diff --git a/V2rayNG/app/src/main/res/values-vi/strings.xml b/V2rayNG/app/src/main/res/values-vi/strings.xml index 133ae493..43fac0f5 100644 --- a/V2rayNG/app/src/main/res/values-vi/strings.xml +++ b/V2rayNG/app/src/main/res/values-vi/strings.xml @@ -379,5 +379,6 @@ Least Ping Least Load + Pre-resolving domain… diff --git a/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml b/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml index 04cc6d16..974edcd0 100644 --- a/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml +++ b/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml @@ -383,5 +383,6 @@ 最低延迟 最稳定 + 预解析域名中… diff --git a/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml b/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml index 025d91e7..d254c7c7 100644 --- a/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml +++ b/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml @@ -383,5 +383,6 @@ Least Ping Least Load + Pre-resolving domain… diff --git a/V2rayNG/app/src/main/res/values/strings.xml b/V2rayNG/app/src/main/res/values/strings.xml index 02949084..13683b0d 100644 --- a/V2rayNG/app/src/main/res/values/strings.xml +++ b/V2rayNG/app/src/main/res/values/strings.xml @@ -395,5 +395,6 @@ Least Ping Least Load + Pre-resolving domain…