Skip to content

Commit

Permalink
fix dns routing rule
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Mar 22, 2023
1 parent 506daa8 commit 2ad8b91
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -691,24 +691,38 @@ fun buildConfig(

// dns object user rules
if (enableDnsRouting) {
if (domainListDNSRemote.isNotEmpty() || uidListDNSRemote.isNotEmpty()) {
if (uidListDNSRemote.isNotEmpty()) {
dns.rules.add(
DNSRule_DefaultOptions().apply {
makeSingBoxRule(domainListDNSRemote.toHashSet().toList())
user_id = uidListDNSRemote.toHashSet().toList()
server = "dns-remote"
}
)
}
if (domainListDNSDirect.isNotEmpty() || uidListDNSDirect.isNotEmpty()) {
if (domainListDNSRemote.isNotEmpty()) {
dns.rules.add(
DNSRule_DefaultOptions().apply {
makeSingBoxRule(domainListDNSRemote.toHashSet().toList())
server = "dns-remote"
}
)
}
if (uidListDNSDirect.isNotEmpty()) {
dns.rules.add(
DNSRule_DefaultOptions().apply {
makeSingBoxRule(domainListDNSDirect.toHashSet().toList())
user_id = uidListDNSDirect.toHashSet().toList()
server = "dns-direct"
}
)
}
if (domainListDNSDirect.isNotEmpty()) {
dns.rules.add(
DNSRule_DefaultOptions().apply {
makeSingBoxRule(domainListDNSDirect.toHashSet().toList())
server = "dns-direct"
}
)
}
if (domainListDNSBlock.isNotEmpty()) {
dns.rules.add(
DNSRule_DefaultOptions().apply {
Expand Down

0 comments on commit 2ad8b91

Please sign in to comment.