Adding universal config API and adding allowed/blocked country config

This commit is contained in:
Dawson Hessler
2022-03-18 10:33:14 -04:00
parent 2fbbe5b3c8
commit 8edef241e4
20 changed files with 882 additions and 24 deletions
@@ -1,9 +1,6 @@
package dev.brighten.antivpn.utils;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.*;
import java.lang.reflect.Method;
import java.net.Inet4Address;
import java.net.InetAddress;
@@ -33,6 +30,24 @@ public class MiscUtils {
}
}
public static void copy(InputStream in, File file) {
try {
OutputStream out = new FileOutputStream(file);
int lenght;
byte[] buf = new byte[1024];
while ((lenght = in.read(buf)) > 0)
{
out.write(buf, 0, lenght);
}
out.close();
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static boolean isIpv4(String ip)
{
return ipv4.matcher(ip).matches();