diff --git a/easytier-gui/src/components/Config.vue b/easytier-gui/src/components/Config.vue index 7e1e38f..199490f 100644 --- a/easytier-gui/src/components/Config.vue +++ b/easytier-gui/src/components/Config.vue @@ -102,6 +102,10 @@ const searchListenerSuggestiong = (e: { query: string }) => { } } + if (ret.length === 0) { + ret.push(e.query) + } + listenerSuggestions.value = ret } diff --git a/tauri-plugin-vpnservice/android/src/main/java/TauriVpnService.kt b/tauri-plugin-vpnservice/android/src/main/java/TauriVpnService.kt index 28f78b4..8e31dd8 100644 --- a/tauri-plugin-vpnservice/android/src/main/java/TauriVpnService.kt +++ b/tauri-plugin-vpnservice/android/src/main/java/TauriVpnService.kt @@ -2,7 +2,6 @@ package com.plugin.vpnservice import android.content.Intent import android.net.VpnService -import android.net.IpPrefix import android.os.Build import android.os.ParcelFileDescriptor import android.os.Bundle @@ -11,16 +10,6 @@ import java.util.Arrays import app.tauri.plugin.JSObject -fun stringToIpPrefix(ipPrefixString: String): IpPrefix { - val parts = ipPrefixString.split("/") - if (parts.size != 2) throw IllegalArgumentException("Invalid IP prefix string") - - val address = InetAddress.getByName(parts[0]) - val prefixLength = parts[1].toInt() - - return IpPrefix(address, prefixLength) -} - class TauriVpnService : VpnService() { companion object { @JvmField var triggerCallback: (String, JSObject) -> Unit = { _, _ -> } @@ -99,7 +88,9 @@ class TauriVpnService : VpnService() { builder.addDnsServer(dns) for (route in routes) { - builder.addRoute(stringToIpPrefix(route)) + val ipParts = ipv4Addr.split("/") + if (ipParts.size != 2) throw IllegalArgumentException("Invalid IP addr string") + builder.addAddress(ipParts[0], ipParts[1].toInt()) } for (app in disallowedApplications) {