mirror of
https://github.com/M66B/NetGuard.git
synced 2024-12-26 01:38:07 +00:00
Revert "Less VPN reloads when no DNS address set"
This reverts commit e31a7f2519
.
This commit is contained in:
parent
e31a7f2519
commit
b35cc43d9d
2 changed files with 10 additions and 11 deletions
|
@ -104,7 +104,7 @@ public class AdapterLog extends CursorAdapter {
|
|||
|
||||
try {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
dns = InetAddress.getByName(prefs.getString("dns", Util.getDefaultDNS(context).get(0)));
|
||||
dns = SinkholeService.getDns(context).get(0);
|
||||
vpn4 = InetAddress.getByName(prefs.getString("vpn4", "10.1.10.1"));
|
||||
vpn6 = InetAddress.getByName(prefs.getString("vpn6", "fd00:1:fd00:1:fd00:1:fd00:1"));
|
||||
} catch (UnknownHostException ex) {
|
||||
|
|
|
@ -951,7 +951,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
|
|||
String vpnDns = prefs.getString("dns", null);
|
||||
Log.i(TAG, "DNS system=" + TextUtils.join(",", sysDns) + " VPN=" + vpnDns);
|
||||
|
||||
if (vpnDns != null) {
|
||||
if (vpnDns != null)
|
||||
try {
|
||||
InetAddress dns = InetAddress.getByName(vpnDns);
|
||||
if (!(dns.isLoopbackAddress() || dns.isAnyLocalAddress()))
|
||||
|
@ -959,15 +959,14 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
|
|||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
for (String def_dns : sysDns)
|
||||
try {
|
||||
InetAddress ddns = InetAddress.getByName(def_dns);
|
||||
if (!listDns.contains(ddns) &&
|
||||
!(ddns.isLoopbackAddress() || ddns.isAnyLocalAddress()))
|
||||
listDns.add(ddns);
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
for (String def_dns : sysDns)
|
||||
try {
|
||||
InetAddress ddns = InetAddress.getByName(def_dns);
|
||||
if (!listDns.contains(ddns) &&
|
||||
!(ddns.isLoopbackAddress() || ddns.isAnyLocalAddress()))
|
||||
listDns.add(ddns);
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
return listDns;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue