mirror of https://github.com/M66B/NetGuard.git
Compare commits
9 Commits
Author | SHA1 | Date |
---|---|---|
Marcel Bokhorst | feef4c7b3b | |
M66B | f050f90e2c | |
M66B | 1f56b996f5 | |
M66B | 69e2a37200 | |
M66B | c5e9414bb4 | |
M66B | 589b4828b1 | |
M66B | 37ff174b1f | |
M66B | a3375e11c8 | |
M66B | d786249594 |
2
FAQ.md
2
FAQ.md
|
@ -37,6 +37,8 @@ However, this does not work properly on all Android versions/variants causing Ne
|
|||
On Android N and later NetGuard can be configured as [Always-On VPN](https://developer.android.com/guide/topics/connectivity/vpn#always-on).
|
||||
On Android O **do not** enable the sub option '*Block connections without VPN*', see [question 51](#user-content-faq51)) for more information on this.
|
||||
|
||||
The app obviously can't protect you from bugs in Android, such a documented [here](https://mullvad.net/en/blog/dns-traffic-can-leak-outside-the-vpn-tunnel-on-android).
|
||||
|
||||
To protect yourself more, remember to disable Wi-Fi and mobile data before rebooting,
|
||||
and only enable them on reboot, after the firewall service has started (and the key icon is visible in the status bar).
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
applicationId = "eu.faircode.netguard"
|
||||
versionName = "2.326"
|
||||
versionName = "2.328"
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 34
|
||||
versionCode = 2023120101
|
||||
versionCode = 2024022201
|
||||
archivesBaseName = "NetGuard-v$versionName"
|
||||
|
||||
externalNativeBuild {
|
||||
|
|
|
@ -104,6 +104,7 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
@ -1242,7 +1243,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
|
||||
Network active = (cm == null ? null : cm.getActiveNetwork());
|
||||
if (active != null) {
|
||||
Log.i(TAG, "Setting underlying network=" + cm.getNetworkInfo(active));
|
||||
Log.i(TAG, "Setting underlying network=" + active + " " + cm.getNetworkInfo(active));
|
||||
setUnderlyingNetworks(new Network[]{active});
|
||||
}
|
||||
}
|
||||
|
@ -1291,6 +1292,20 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
}
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
try {
|
||||
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
Network active = (cm == null ? null : cm.getActiveNetwork());
|
||||
LinkProperties props = (active == null ? null : cm.getLinkProperties(active));
|
||||
String domain = (props == null ? null : props.getDomains());
|
||||
if (domain != null) {
|
||||
Log.i(TAG, "Using search domain=" + domain);
|
||||
builder.addSearchDomain(domain);
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
|
||||
// Subnet routing
|
||||
if (subnet) {
|
||||
// Exclude IP ranges
|
||||
|
@ -3231,6 +3246,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
}
|
||||
|
||||
private class Builder extends VpnService.Builder {
|
||||
private Network activeNetwork;
|
||||
private NetworkInfo networkInfo;
|
||||
private int mtu;
|
||||
private List<String> listAddress = new ArrayList<>();
|
||||
|
@ -3242,6 +3258,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
private Builder() {
|
||||
super();
|
||||
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
activeNetwork = (Build.VERSION.SDK_INT < Build.VERSION_CODES.M ? null : cm.getActiveNetwork());
|
||||
networkInfo = cm.getActiveNetworkInfo();
|
||||
}
|
||||
|
||||
|
@ -3300,6 +3317,9 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
if (other == null)
|
||||
return false;
|
||||
|
||||
if (!Objects.equals(this.activeNetwork, other.activeNetwork))
|
||||
return false;
|
||||
|
||||
if (this.networkInfo == null || other.networkInfo == null ||
|
||||
this.networkInfo.getType() != other.networkInfo.getType())
|
||||
return false;
|
||||
|
|
|
@ -38,7 +38,6 @@ import android.graphics.BitmapFactory;
|
|||
import android.net.ConnectivityManager;
|
||||
import android.net.LinkProperties;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
|
@ -112,7 +111,6 @@ public class Util {
|
|||
"NO", // Norway
|
||||
"PL", // Poland
|
||||
"PT", // Portugal
|
||||
"RE", // La Réunion
|
||||
"RO", // Romania
|
||||
"SK", // Slovakia
|
||||
"SI", // Slovenia
|
||||
|
@ -166,6 +164,16 @@ public class Util {
|
|||
if (ni != null && ni.isConnected())
|
||||
return true;
|
||||
|
||||
Network[] networks = cm.getAllNetworks();
|
||||
if (networks == null)
|
||||
return false;
|
||||
|
||||
for (Network network : networks) {
|
||||
ni = cm.getNetworkInfo(network);
|
||||
if (ni != null && ni.getType() != ConnectivityManager.TYPE_VPN && ni.isConnected())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,13 @@
|
|||
package="com.google.android.apps.gcs"
|
||||
roaming="false" />
|
||||
|
||||
<wifi
|
||||
blocked="false"
|
||||
package="com.samsung.android.fmm" />
|
||||
<other
|
||||
blocked="false"
|
||||
package="com.samsung.android.fmm" />
|
||||
|
||||
<relation
|
||||
package="com.android.vending"
|
||||
related="com.google.android.gms,com.android.providers.downloads" />
|
||||
|
|
Loading…
Reference in New Issue