diff --git a/V2rayNG/app/src/main/assets/custom_routing_black b/V2rayNG/app/src/main/assets/custom_routing_black index e394a495..c10156a3 100644 --- a/V2rayNG/app/src/main/assets/custom_routing_black +++ b/V2rayNG/app/src/main/assets/custom_routing_black @@ -27,13 +27,6 @@ "geosite:category-ads-all" ] }, - { - "remarks": "绕过局域网域名", - "outboundTag": "direct", - "domain": [ - "geosite:private" - ] - }, { "remarks": "绕过局域网IP", "outboundTag": "direct", @@ -41,6 +34,13 @@ "geoip:private" ] }, + { + "remarks": "绕过局域网域名", + "outboundTag": "direct", + "domain": [ + "geosite:private" + ] + }, { "remarks": "代理GFW", "outboundTag": "proxy", diff --git a/V2rayNG/app/src/main/assets/custom_routing_global b/V2rayNG/app/src/main/assets/custom_routing_global index 75e6051b..99006d9b 100644 --- a/V2rayNG/app/src/main/assets/custom_routing_global +++ b/V2rayNG/app/src/main/assets/custom_routing_global @@ -12,13 +12,6 @@ "geosite:category-ads-all" ] }, - { - "remarks": "绕过局域网域名", - "outboundTag": "direct", - "domain": [ - "geosite:private" - ] - }, { "remarks": "绕过局域网IP", "outboundTag": "direct", @@ -26,6 +19,13 @@ "geoip:private" ] }, + { + "remarks": "绕过局域网域名", + "outboundTag": "direct", + "domain": [ + "geosite:private" + ] + }, { "remarks": "最终代理", "port": "0-65535", diff --git a/V2rayNG/app/src/main/assets/custom_routing_white b/V2rayNG/app/src/main/assets/custom_routing_white index 008120aa..892fd19a 100644 --- a/V2rayNG/app/src/main/assets/custom_routing_white +++ b/V2rayNG/app/src/main/assets/custom_routing_white @@ -20,13 +20,6 @@ "geosite:category-ads-all" ] }, - { - "remarks": "绕过局域网域名", - "outboundTag": "direct", - "domain": [ - "geosite:private" - ] - }, { "remarks": "绕过局域网IP", "outboundTag": "direct", @@ -34,6 +27,13 @@ "geoip:private" ] }, + { + "remarks": "绕过局域网域名", + "outboundTag": "direct", + "domain": [ + "geosite:private" + ] + }, { "remarks": "绕过中国域名", "outboundTag": "direct", diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt index d00950f1..3d209651 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt @@ -105,7 +105,10 @@ object AppConfig { const val DNS_PROXY = "1.1.1.1" const val DNS_DIRECT = "223.5.5.5" const val DNS_VPN = "1.1.1.1" - + const val GEOSITE_PRIVATE = "geosite:private" + const val GEOSITE_CN = "geosite:cn" + const val GEOIP_PRIVATE = "geoip:private" + const val GEOIP_CN = "geoip:cn" /** Ports and addresses for various services. */ const val PORT_LOCAL_DNS = "10853" diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/SettingsManager.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/SettingsManager.kt index 53e13138..c892a10f 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/SettingsManager.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/SettingsManager.kt @@ -4,6 +4,8 @@ import android.content.Context import android.text.TextUtils import com.v2ray.ang.AppConfig +import com.v2ray.ang.AppConfig.GEOIP_PRIVATE +import com.v2ray.ang.AppConfig.GEOSITE_PRIVATE import com.v2ray.ang.dto.RulesetItem import com.v2ray.ang.dto.ServerConfig import com.v2ray.ang.util.MmkvManager.decodeProfileConfig @@ -109,7 +111,11 @@ object SettingsManager { fun routingRulesetsBypassLan(): Boolean { val rulesetItems = MmkvManager.decodeRoutingRulesets() - val exist = rulesetItems?.any { it.enabled && it.domain?.contains(":private") == true } + val exist = rulesetItems?.any { + it.enabled + && (it.domain?.contains(GEOSITE_PRIVATE) == true + || it.ip?.contains(GEOIP_PRIVATE) == true) + } return exist == true } 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 aa04e075..1e1b4504 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 @@ -6,7 +6,10 @@ import android.util.Log import com.v2ray.ang.AppConfig import com.v2ray.ang.AppConfig.ANG_PACKAGE +import com.v2ray.ang.AppConfig.GEOIP_CN +import com.v2ray.ang.AppConfig.GEOSITE_CN import com.v2ray.ang.AppConfig.LOOPBACK +import com.v2ray.ang.AppConfig.GEOSITE_PRIVATE import com.v2ray.ang.AppConfig.PROTOCOL_FREEDOM import com.v2ray.ang.AppConfig.TAG_BLOCKED import com.v2ray.ang.AppConfig.TAG_DIRECT @@ -222,7 +225,9 @@ object V2rayConfigUtil { rulesetItems?.forEach { key -> if (key != null && key.enabled && key.outboundTag == tag && !key.domain.isNullOrEmpty()) { key.domain?.forEach { - if (it.startsWith("geosite:") || it.startsWith("domain:")) { + if (it != GEOSITE_PRIVATE + && (it.startsWith("geosite:") || it.startsWith("domain:")) + ) { domain.add(it) } } @@ -235,7 +240,7 @@ object V2rayConfigUtil { private fun customLocalDns(v2rayConfig: V2rayConfig): Boolean { try { if (settingsStorage?.decodeBool(AppConfig.PREF_FAKE_DNS_ENABLED) == true) { - val geositeCn = arrayListOf("geosite:cn") + val geositeCn = arrayListOf(GEOSITE_CN) val proxyDomain = userRule2Domain(TAG_PROXY) val directDomain = userRule2Domain(TAG_DIRECT) // fakedns with all domains to make it always top priority @@ -326,8 +331,8 @@ object V2rayConfigUtil { // domestic DNS val domesticDns = Utils.getDomesticDnsServers() val directDomain = userRule2Domain(TAG_DIRECT) - val isCnRoutingMode = directDomain.contains("geosite:cn") - val geoipCn = arrayListOf("geoip:cn") + val isCnRoutingMode = directDomain.contains(GEOSITE_CN) + val geoipCn = arrayListOf(GEOIP_CN) if (directDomain.size > 0) { servers.add( V2rayConfig.DnsBean.ServersBean(