Update local DNS transport registration

This commit is contained in:
世界 2025-01-28 09:11:09 +08:00
parent 599d8cecac
commit 184f2eeb7b
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 5 additions and 2 deletions

View file

@ -150,7 +150,6 @@ class BoxService(
}
DefaultNetworkMonitor.start()
Libbox.registerLocalDNSTransport(LocalResolver)
Libbox.setMemoryLimit(!Settings.disableMemoryLimit)
val newService = try {
@ -263,7 +262,6 @@ class BoxService(
}
commandServer?.setService(null)
boxService = null
Libbox.registerLocalDNSTransport(null)
DefaultNetworkMonitor.stop()
commandServer?.apply {

View file

@ -10,6 +10,7 @@ import android.util.Log
import androidx.annotation.RequiresApi
import io.nekohasekai.libbox.InterfaceUpdateListener
import io.nekohasekai.libbox.Libbox
import io.nekohasekai.libbox.LocalDNSTransport
import io.nekohasekai.libbox.NetworkInterfaceIterator
import io.nekohasekai.libbox.PlatformInterface
import io.nekohasekai.libbox.StringIterator
@ -169,6 +170,10 @@ interface PlatformInterfaceWrapper : PlatformInterface {
return WIFIState(ssid, wifiInfo.bssid)
}
override fun localDNSTransport(): LocalDNSTransport? {
return LocalResolver
}
private class InterfaceArray(private val iterator: Iterator<LibboxNetworkInterface>) :
NetworkInterfaceIterator {