mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-19 14:40:06 +08:00
apply doamin_strategy for inbounds
This commit is contained in:
parent
03c99d7482
commit
506daa853a
@ -157,6 +157,16 @@ fun buildConfig(
|
|||||||
val resolveDestination = DataStore.resolveDestination
|
val resolveDestination = DataStore.resolveDestination
|
||||||
val alerts = mutableListOf<Pair<Int, String>>()
|
val alerts = mutableListOf<Pair<Int, String>>()
|
||||||
|
|
||||||
|
fun genDomainStrategy(noAsIs: Boolean): String {
|
||||||
|
return when {
|
||||||
|
!resolveDestination && !noAsIs -> ""
|
||||||
|
ipv6Mode == IPv6Mode.DISABLE -> "ipv4_only"
|
||||||
|
ipv6Mode == IPv6Mode.PREFER -> "prefer_ipv6"
|
||||||
|
ipv6Mode == IPv6Mode.ONLY -> "ipv6_only"
|
||||||
|
else -> "prefer_ipv4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return MyOptions().apply {
|
return MyOptions().apply {
|
||||||
if (!forTest && DataStore.enableClashAPI) experimental = ExperimentalOptions().apply {
|
if (!forTest && DataStore.enableClashAPI) experimental = ExperimentalOptions().apply {
|
||||||
clash_api = ClashAPIOptions().apply {
|
clash_api = ClashAPIOptions().apply {
|
||||||
@ -206,6 +216,7 @@ fun buildConfig(
|
|||||||
stack = if (DataStore.tunImplementation == 1) "system" else "gvisor"
|
stack = if (DataStore.tunImplementation == 1) "system" else "gvisor"
|
||||||
sniff = needSniff
|
sniff = needSniff
|
||||||
endpoint_independent_nat = true
|
endpoint_independent_nat = true
|
||||||
|
domain_strategy = genDomainStrategy(false)
|
||||||
when (ipv6Mode) {
|
when (ipv6Mode) {
|
||||||
IPv6Mode.DISABLE -> {
|
IPv6Mode.DISABLE -> {
|
||||||
inet4_address = listOf(VpnService.PRIVATE_VLAN4_CLIENT + "/28")
|
inet4_address = listOf(VpnService.PRIVATE_VLAN4_CLIENT + "/28")
|
||||||
@ -224,6 +235,7 @@ fun buildConfig(
|
|||||||
tag = TAG_MIXED
|
tag = TAG_MIXED
|
||||||
listen = bind
|
listen = bind
|
||||||
listen_port = DataStore.mixedPort
|
listen_port = DataStore.mixedPort
|
||||||
|
domain_strategy = genDomainStrategy(false)
|
||||||
if (needSniff) {
|
if (needSniff) {
|
||||||
sniff = true
|
sniff = true
|
||||||
// destOverride = when {
|
// destOverride = when {
|
||||||
@ -245,6 +257,7 @@ fun buildConfig(
|
|||||||
listen = bind
|
listen = bind
|
||||||
listen_port = DataStore.transproxyPort
|
listen_port = DataStore.transproxyPort
|
||||||
sniff = needSniff
|
sniff = needSniff
|
||||||
|
domain_strategy = genDomainStrategy(false)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
inbounds.add(Inbound_RedirectOptions().apply {
|
inbounds.add(Inbound_RedirectOptions().apply {
|
||||||
@ -253,6 +266,7 @@ fun buildConfig(
|
|||||||
listen = bind
|
listen = bind
|
||||||
listen_port = DataStore.transproxyPort
|
listen_port = DataStore.transproxyPort
|
||||||
sniff = needSniff
|
sniff = needSniff
|
||||||
|
domain_strategy = genDomainStrategy(false)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,16 +302,6 @@ fun buildConfig(
|
|||||||
val chainTag = "c-$chainId"
|
val chainTag = "c-$chainId"
|
||||||
var muxApplied = false
|
var muxApplied = false
|
||||||
|
|
||||||
fun genDomainStrategy(noAsIs: Boolean): String {
|
|
||||||
return when {
|
|
||||||
!resolveDestination && !noAsIs -> ""
|
|
||||||
ipv6Mode == IPv6Mode.DISABLE -> "ipv4_only"
|
|
||||||
ipv6Mode == IPv6Mode.PREFER -> "prefer_ipv6"
|
|
||||||
ipv6Mode == IPv6Mode.ONLY -> "ipv6_only"
|
|
||||||
else -> "prefer_ipv4"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentDomainStrategy = genDomainStrategy(false)
|
var currentDomainStrategy = genDomainStrategy(false)
|
||||||
|
|
||||||
profileList.forEachIndexed { index, proxyEntity ->
|
profileList.forEachIndexed { index, proxyEntity ->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user