Update local DNS transport registration

This commit is contained in:
世界 2025-01-28 09:11:09 +08:00
parent 3a2fc9c880
commit 04a648ec03
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() DefaultNetworkMonitor.start()
Libbox.registerLocalDNSTransport(LocalResolver)
Libbox.setMemoryLimit(!Settings.disableMemoryLimit) Libbox.setMemoryLimit(!Settings.disableMemoryLimit)
val newService = try { val newService = try {
@ -263,7 +262,6 @@ class BoxService(
} }
commandServer?.setService(null) commandServer?.setService(null)
boxService = null boxService = null
Libbox.registerLocalDNSTransport(null)
DefaultNetworkMonitor.stop() DefaultNetworkMonitor.stop()
commandServer?.apply { commandServer?.apply {

View file

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