summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/base
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2021-11-15 15:12:19 +0000
committercyberta <cyberta@riseup.net>2021-11-15 15:12:19 +0000
commit9b2b57d8617e60c0b69713e1e5f14dbb8e57c70a (patch)
tree94e2dfa2f6c4d82a82ef24df6be5ccd219b4e69b /app/src/main/java/se/leap/bitmaskclient/base
parent5b4db114cb35c5c9012c744c82656b1071aacda0 (diff)
parentf18a85e4cd95f938c9ed78b31b8d27b2a02994c7 (diff)
Merge branch 'obfs4_no_udp_no_ipv6' into 'master'
Obfs4: no udp no ipv6 See merge request leap/bitmask_android!142
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/base')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java
index 4248072a..64b51960 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java
@@ -20,6 +20,7 @@ import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.os.Looper;
+
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
@@ -44,10 +45,12 @@ import java.security.interfaces.RSAPrivateKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Calendar;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import se.leap.bitmaskclient.BuildConfig;
-import se.leap.bitmaskclient.providersetup.ProviderAPI;
import se.leap.bitmaskclient.R;
+import se.leap.bitmaskclient.providersetup.ProviderAPI;
import static se.leap.bitmaskclient.base.models.Constants.DEFAULT_BITMASK;
@@ -62,6 +65,7 @@ public class ConfigHelper {
final public static String NG_1024 =
"eeaf0ab9adb38dd69c33f80afa8fc5e86072618775ff3c0b9ea2314c9c256576d674df7496ea81d3383b4813d692c6e0e0d5d8e250b98be48e495c1d6089dad15dc7d7b46154d6b6ce8ef4ad69b15d4982559b297bcf1885c529f566660e57ec68edbc3c05726cc02fd4cbf4976eaa9afd5138fe8376435b9fc61d2fc0eb06e3";
final public static BigInteger G = new BigInteger("2");
+ final public static Pattern IPv4_PATTERN = Pattern.compile("^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$");
public static boolean checkErroneousDownload(String downloadedString) {
try {
@@ -203,6 +207,8 @@ public class ConfigHelper {
(string1 != null && string1.equals(string2));
}
+ @SuppressWarnings("unused")
+ // FatWeb Flavor uses that for auto-update
public static String getApkFileName() {
try {
return BuildConfig.update_apk_url.substring(BuildConfig.update_apk_url.lastIndexOf("/"));
@@ -211,6 +217,8 @@ public class ConfigHelper {
}
}
+ @SuppressWarnings("unused")
+ // FatWeb Flavor uses that for auto-update
public static String getVersionFileName() {
try {
return BuildConfig.version_file_url.substring(BuildConfig.version_file_url.lastIndexOf("/"));
@@ -219,6 +227,8 @@ public class ConfigHelper {
}
}
+ @SuppressWarnings("unused")
+ // FatWeb Flavor uses that for auto-update
public static String getSignatureFileName() {
try {
return BuildConfig.signature_url.substring(BuildConfig.signature_url.lastIndexOf("/"));
@@ -227,4 +237,12 @@ public class ConfigHelper {
}
}
+ public static boolean isIPv4(String ipv4) {
+ if (ipv4 == null) {
+ return false;
+ }
+ Matcher matcher = IPv4_PATTERN.matcher(ipv4);
+ return matcher.matches();
+ }
+
}