Fix deprecations

This commit is contained in:
Mygod
2020-08-18 05:02:09 +08:00
parent 8a1df227c1
commit 35055bc074
10 changed files with 33 additions and 34 deletions

View File

@@ -52,24 +52,24 @@ class Routing(private val caller: Any, private val downstream: String) : IpNeigh
const val IP6TABLES = "ip6tables -w"
fun appendCleanCommands(commands: BufferedWriter) {
commands.appendln("$IPTABLES -t nat -F PREROUTING")
commands.appendln("while $IPTABLES -D FORWARD -j vpnhotspot_fwd; do done")
commands.appendln("$IPTABLES -F vpnhotspot_fwd")
commands.appendln("$IPTABLES -X vpnhotspot_fwd")
commands.appendln("$IPTABLES -F vpnhotspot_acl")
commands.appendln("$IPTABLES -X vpnhotspot_acl")
commands.appendln("while $IPTABLES -t nat -D POSTROUTING -j vpnhotspot_masquerade; do done")
commands.appendln("$IPTABLES -t nat -F vpnhotspot_masquerade")
commands.appendln("$IPTABLES -t nat -X vpnhotspot_masquerade")
commands.appendln("while $IP6TABLES -D INPUT -j vpnhotspot_filter; do done")
commands.appendln("while $IP6TABLES -D FORWARD -j vpnhotspot_filter; do done")
commands.appendln("while $IP6TABLES -D OUTPUT -j vpnhotspot_filter; do done")
commands.appendln("$IP6TABLES -F vpnhotspot_filter")
commands.appendln("$IP6TABLES -X vpnhotspot_filter")
commands.appendln("while $IP rule del priority $RULE_PRIORITY_DNS; do done")
commands.appendln("while $IP rule del priority $RULE_PRIORITY_UPSTREAM; do done")
commands.appendln("while $IP rule del priority $RULE_PRIORITY_UPSTREAM_FALLBACK; do done")
commands.appendln("while $IP rule del priority $RULE_PRIORITY_UPSTREAM_DISABLE_SYSTEM; do done")
commands.appendLine("$IPTABLES -t nat -F PREROUTING")
commands.appendLine("while $IPTABLES -D FORWARD -j vpnhotspot_fwd; do done")
commands.appendLine("$IPTABLES -F vpnhotspot_fwd")
commands.appendLine("$IPTABLES -X vpnhotspot_fwd")
commands.appendLine("$IPTABLES -F vpnhotspot_acl")
commands.appendLine("$IPTABLES -X vpnhotspot_acl")
commands.appendLine("while $IPTABLES -t nat -D POSTROUTING -j vpnhotspot_masquerade; do done")
commands.appendLine("$IPTABLES -t nat -F vpnhotspot_masquerade")
commands.appendLine("$IPTABLES -t nat -X vpnhotspot_masquerade")
commands.appendLine("while $IP6TABLES -D INPUT -j vpnhotspot_filter; do done")
commands.appendLine("while $IP6TABLES -D FORWARD -j vpnhotspot_filter; do done")
commands.appendLine("while $IP6TABLES -D OUTPUT -j vpnhotspot_filter; do done")
commands.appendLine("$IP6TABLES -F vpnhotspot_filter")
commands.appendLine("$IP6TABLES -X vpnhotspot_filter")
commands.appendLine("while $IP rule del priority $RULE_PRIORITY_DNS; do done")
commands.appendLine("while $IP rule del priority $RULE_PRIORITY_UPSTREAM; do done")
commands.appendLine("while $IP rule del priority $RULE_PRIORITY_UPSTREAM_FALLBACK; do done")
commands.appendLine("while $IP rule del priority $RULE_PRIORITY_UPSTREAM_DISABLE_SYSTEM; do done")
}
suspend fun clean() {

View File

@@ -219,7 +219,8 @@ data class SoftApConfigurationCompat(
SoftApConfiguration.SECURITY_TYPE_WPA2_PSK
}
android.net.wifi.WifiConfiguration.KeyMgmt.SAE -> SoftApConfiguration.SECURITY_TYPE_WPA3_SAE
else -> android.net.wifi.WifiConfiguration.KeyMgmt.strings.getOrElse(selected) { "?" }.let {
else -> android.net.wifi.WifiConfiguration.KeyMgmt.strings
.getOrElse<String>(selected) { "?" }.let {
throw IllegalArgumentException("Unrecognized key management $it ($selected)")
}
}