File tree Expand file tree Collapse file tree
app/src/main/java/io/nekohasekai/sfa/bg Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import android.net.VpnService
77import android.os.Build
88import android.os.IBinder
99import android.util.Log
10+ import io.nekohasekai.libbox.Libbox
1011import io.nekohasekai.libbox.Notification
1112import io.nekohasekai.libbox.TunOptions
1213import 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
You can’t perform that action at this time.
0 commit comments