mirror of
https://github.com/M66B/NetGuard.git
synced 2025-02-07 23:32:56 +00:00
Get default DNS stub
This commit is contained in:
parent
cf1263c309
commit
c1a6b6d022
3 changed files with 8 additions and 2 deletions
|
@ -65,7 +65,7 @@ public class LogAdapter extends CursorAdapter {
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
vpn4 = InetAddress.getByName(prefs.getString("vpn4", "10.1.10.1"));
|
||||
vpn6 = InetAddress.getByName(prefs.getString("vpn6", "fd00:1:fd00:1:fd00:1:fd00:1"));
|
||||
dns = InetAddress.getByName(prefs.getString("dns", "8.8.8.8"));
|
||||
dns = InetAddress.getByName(prefs.getString("dns", Util.getDefaultDNS(context)));
|
||||
} catch (UnknownHostException ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
|
|
|
@ -667,7 +667,9 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
|
|||
|
||||
if (filter) {
|
||||
// TODO multiple DNS servers
|
||||
builder.addDnsServer(prefs.getString("dns", "8.8.8.8"));
|
||||
String dns = prefs.getString("dns", Util.getDefaultDNS(SinkholeService.this));
|
||||
Log.i(TAG, "DNS " + dns);
|
||||
builder.addDnsServer(dns);
|
||||
}
|
||||
|
||||
if (tethering) {
|
||||
|
|
|
@ -281,6 +281,10 @@ public class Util {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static String getDefaultDNS(Context context) {
|
||||
return "8.8.8.8";//"2001:4860:4860::8888";
|
||||
}
|
||||
|
||||
public static boolean isInteractive(Context context) {
|
||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
return (pm != null && pm.isInteractive());
|
||||
|
|
Loading…
Reference in a new issue