From ad614b3b4a6e478799130a8472d765de0d70ef81 Mon Sep 17 00:00:00 2001 From: CherretGit Date: Mon, 3 Nov 2025 02:19:06 +0700 Subject: [PATCH] fix ByeDpiVpnService --- .../zaprett/byedpi/ByeDpiVpnService.kt | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/cherret/zaprett/byedpi/ByeDpiVpnService.kt b/app/src/main/java/com/cherret/zaprett/byedpi/ByeDpiVpnService.kt index 55a27eb..24c7094 100644 --- a/app/src/main/java/com/cherret/zaprett/byedpi/ByeDpiVpnService.kt +++ b/app/src/main/java/com/cherret/zaprett/byedpi/ByeDpiVpnService.kt @@ -266,24 +266,18 @@ class ByeDpiVpnService : VpnService() { .flatMap { arg -> if (getHostListMode(sharedPreferences) == "whitelist") { when { - arg == "\$hostlist" && list.isNotEmpty() -> listOf("-H", list) + arg == "\$hostlist" && list.isNotEmpty() -> listOf("--hosts", list) arg == "\$hostlist" && list.isEmpty() -> emptyList() - arg == "\$ipset" && list.isNotEmpty() -> listOf("-H", list) + arg == "\$ipset" && list.isNotEmpty() -> listOf("--ipset", list) arg == "\$ipset" && list.isEmpty() -> emptyList() else -> listOf(arg) } } else { - if (list.isNotEmpty()) { - listOf("-H", list, "-An", arg).filter { it != "\$hostlist" } - } else { - listOf("-An", arg).filter { it != "\$hostlist" } - } - if (ipset.isEmpty()) { - listOf("-H", list, "-An", arg).filter { it != "\$ipset" } - - } - else { - listOf("-An", arg).filter { it != "\$ipset" } + when { + arg == "\$hostlist" && list.isNotEmpty() -> listOf("--hosts", list, "-An", list) + arg == "\$ipset" && ipset.isNotEmpty() -> listOf("--ipset", ipset, "-An", ipset) + arg == "\$hostlist" || arg == "\$ipset" -> emptyList() + else -> listOf(arg) } } }