Skip to content

Commit a5a28c7

Browse files
committed
Use new DNS mode
1 parent 74e62fd commit a5a28c7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

app/src/main/java/io/nekohasekai/sfa/bg/VPNService.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.net.VpnService
77
import android.os.Build
88
import android.os.IBinder
99
import android.util.Log
10+
import io.nekohasekai.libbox.Libbox
1011
import io.nekohasekai.libbox.Notification
1112
import io.nekohasekai.libbox.TunOptions
1213
import io.nekohasekai.sfa.database.Settings
@@ -83,7 +84,12 @@ class VPNService :
8384
}
8485

8586
if (options.autoRoute) {
86-
builder.addDnsServer(options.dnsServerAddress.value)
87+
if (options.dnsMode.value != Libbox.DNSModeDisabled) {
88+
val dnsServerAddress = options.dnsServerAddress
89+
while (dnsServerAddress.hasNext()) {
90+
builder.addDnsServer(dnsServerAddress.next())
91+
}
92+
}
8793

8894
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
8995
val inet4RouteAddress = options.inet4RouteAddress

0 commit comments

Comments
 (0)