Improves intelligent selection toast and DNS routing (#4838)
* Improves intelligent selection toast and DNS routing * rename
This commit is contained in:
@@ -91,6 +91,8 @@ object AppConfig {
|
|||||||
const val TAG_DIRECT = "direct"
|
const val TAG_DIRECT = "direct"
|
||||||
const val TAG_BLOCKED = "block"
|
const val TAG_BLOCKED = "block"
|
||||||
const val TAG_FRAGMENT = "fragment"
|
const val TAG_FRAGMENT = "fragment"
|
||||||
|
const val TAG_DNS = "dns-module"
|
||||||
|
const val TAG_DOMESTIC_DNS = "domestic-dns"
|
||||||
|
|
||||||
/** Network-related constants. */
|
/** Network-related constants. */
|
||||||
const val UPLINK = "uplink"
|
const val UPLINK = "uplink"
|
||||||
|
|||||||
@@ -490,6 +490,7 @@ data class V2rayConfig(
|
|||||||
var expectIPs: List<String>? = null,
|
var expectIPs: List<String>? = null,
|
||||||
val clientIp: String? = null,
|
val clientIp: String? = null,
|
||||||
val skipFallback: Boolean? = null,
|
val skipFallback: Boolean? = null,
|
||||||
|
val tag: String? = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -574,18 +574,8 @@ object V2rayConfigManager {
|
|||||||
address = domesticDns.first(),
|
address = domesticDns.first(),
|
||||||
domains = directDomain,
|
domains = directDomain,
|
||||||
expectIPs = if (isCnRoutingMode) geoipCn else null,
|
expectIPs = if (isCnRoutingMode) geoipCn else null,
|
||||||
skipFallback = true
|
skipFallback = true,
|
||||||
)
|
tag = AppConfig.TAG_DOMESTIC_DNS
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Utils.isPureIpAddress(domesticDns.first())) {
|
|
||||||
v2rayConfig.routing.rules.add(
|
|
||||||
0, RulesBean(
|
|
||||||
outboundTag = AppConfig.TAG_DIRECT,
|
|
||||||
port = "53",
|
|
||||||
ip = arrayListOf(domesticDns.first()),
|
|
||||||
domain = null
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -626,20 +616,26 @@ object V2rayConfigManager {
|
|||||||
// DNS dns
|
// DNS dns
|
||||||
v2rayConfig.dns = V2rayConfig.DnsBean(
|
v2rayConfig.dns = V2rayConfig.DnsBean(
|
||||||
servers = servers,
|
servers = servers,
|
||||||
hosts = hosts
|
hosts = hosts,
|
||||||
|
tag = AppConfig.TAG_DNS
|
||||||
)
|
)
|
||||||
|
|
||||||
// DNS routing
|
// DNS routing
|
||||||
if (Utils.isPureIpAddress(remoteDns.first())) {
|
v2rayConfig.routing.rules.add(
|
||||||
v2rayConfig.routing.rules.add(
|
0, RulesBean(
|
||||||
0, RulesBean(
|
outboundTag = AppConfig.TAG_PROXY,
|
||||||
outboundTag = AppConfig.TAG_PROXY,
|
inboundTag = arrayListOf(AppConfig.TAG_DNS),
|
||||||
port = "53",
|
domain = null
|
||||||
ip = arrayListOf(remoteDns.first()),
|
|
||||||
domain = null
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
)
|
||||||
|
|
||||||
|
v2rayConfig.routing.rules.add(
|
||||||
|
0, RulesBean(
|
||||||
|
outboundTag = AppConfig.TAG_DIRECT,
|
||||||
|
inboundTag = arrayListOf(AppConfig.TAG_DOMESTIC_DNS),
|
||||||
|
domain = null
|
||||||
|
)
|
||||||
|
)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(AppConfig.TAG, "Failed to configure DNS", e)
|
Log.e(AppConfig.TAG, "Failed to configure DNS", e)
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -386,6 +386,9 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
|
|||||||
}
|
}
|
||||||
|
|
||||||
R.id.intelligent_selection_all -> {
|
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()
|
mainViewModel.createIntelligentSelectionAll()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -377,5 +377,6 @@
|
|||||||
<item>Least Ping</item>
|
<item>Least Ping</item>
|
||||||
<item>Least Load</item>
|
<item>Least Load</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string name="pre_resolving_domain">Pre-resolving domain…</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -382,5 +382,6 @@
|
|||||||
<item>Least Ping</item>
|
<item>Least Ping</item>
|
||||||
<item>Least Load</item>
|
<item>Least Load</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string name="pre_resolving_domain">Pre-resolving domain…</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -392,5 +392,6 @@
|
|||||||
<item>کم ترین پینگ</item>
|
<item>کم ترین پینگ</item>
|
||||||
<item>کم ترین بار(لود)</item>
|
<item>کم ترین بار(لود)</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string name="pre_resolving_domain">Pre-resolving domain…</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -391,5 +391,6 @@
|
|||||||
<item>کمترین پینگ</item>
|
<item>کمترین پینگ</item>
|
||||||
<item>کمترین بار(لود)</item>
|
<item>کمترین بار(لود)</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string name="pre_resolving_domain">Pre-resolving domain…</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -391,5 +391,6 @@
|
|||||||
<item>Наименьшая задержка</item>
|
<item>Наименьшая задержка</item>
|
||||||
<item>Наименьшая нагрузка</item>
|
<item>Наименьшая нагрузка</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string name="pre_resolving_domain">Pre-resolving domain…</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -379,5 +379,6 @@
|
|||||||
<item>Least Ping</item>
|
<item>Least Ping</item>
|
||||||
<item>Least Load</item>
|
<item>Least Load</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string name="pre_resolving_domain">Pre-resolving domain…</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -383,5 +383,6 @@
|
|||||||
<item>最低延迟</item>
|
<item>最低延迟</item>
|
||||||
<item>最稳定</item>
|
<item>最稳定</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string name="pre_resolving_domain">预解析域名中…</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -383,5 +383,6 @@
|
|||||||
<item>Least Ping</item>
|
<item>Least Ping</item>
|
||||||
<item>Least Load</item>
|
<item>Least Load</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string name="pre_resolving_domain">Pre-resolving domain…</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -395,5 +395,6 @@
|
|||||||
<item>Least Ping</item>
|
<item>Least Ping</item>
|
||||||
<item>Least Load</item>
|
<item>Least Load</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string name="pre_resolving_domain">Pre-resolving domain…</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user