Fix settings not persisted

This commit is contained in:
Mygod
2018-04-21 14:30:00 -07:00
parent 5c3b2363f5
commit 7f81b3ae33
4 changed files with 30 additions and 2 deletions

View File

@@ -101,8 +101,7 @@ class Routing(val upstream: String?, val downstream: String, ownerAddress: InetA
fun dnsRedirect(dnses: List<InetAddress>): Routing {
val hostAddress = hostAddress.hostAddress
val dns = dnses.firstOrNull { it is Inet4Address }?.hostAddress
?: app.pref.getString("service.dns", "8.8.8.8")
val dns = dnses.firstOrNull { it is Inet4Address }?.hostAddress ?: app.dns
debugLog("Routing", "Using $dns from ($dnses)")
startScript.add("$IPTABLES -t nat -A PREROUTING -i $downstream -p tcp -d $hostAddress --dport 53 -j DNAT --to-destination $dns")
startScript.add("$IPTABLES -t nat -A PREROUTING -i $downstream -p udp -d $hostAddress --dport 53 -j DNAT --to-destination $dns")