From 2ce3c747af032b48bd7696f31dd8856ac7f3f917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 3 Dec 2024 12:16:16 +0800 Subject: [PATCH] Update DNS resolver usages --- app/src/main/java/io/nekohasekai/sfa/bg/BoxService.kt | 2 -- .../java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/nekohasekai/sfa/bg/BoxService.kt b/app/src/main/java/io/nekohasekai/sfa/bg/BoxService.kt index c8361b8..0d130a4 100644 --- a/app/src/main/java/io/nekohasekai/sfa/bg/BoxService.kt +++ b/app/src/main/java/io/nekohasekai/sfa/bg/BoxService.kt @@ -143,7 +143,6 @@ class BoxService( } DefaultNetworkMonitor.start() - Libbox.registerLocalDNSTransport(LocalResolver) Libbox.setMemoryLimit(!Settings.disableMemoryLimit) val newService = try { @@ -256,7 +255,6 @@ class BoxService( } commandServer?.setService(null) boxService = null - Libbox.registerLocalDNSTransport(null) DefaultNetworkMonitor.stop() commandServer?.apply { diff --git a/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt b/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt index a6c6fe0..57be231 100644 --- a/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt +++ b/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt @@ -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 @@ -24,6 +25,10 @@ import io.nekohasekai.libbox.NetworkInterface as LibboxNetworkInterface interface PlatformInterfaceWrapper : PlatformInterface { + override fun localDNSTransport(): LocalDNSTransport? { + return LocalResolver + } + override fun usePlatformAutoDetectInterfaceControl(): Boolean { return true }