some refactoring
This commit is contained in:
@@ -23,6 +23,8 @@ public class GithubList{
|
||||
return null;
|
||||
}
|
||||
|
||||
Log.d(proxyname, response);
|
||||
|
||||
return new ArrayList<>(Arrays.asList(response.split("\n")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ru.vtosters.lite.proxy;
|
||||
|
||||
import static java.lang.System.clearProperty;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
|
||||
@@ -11,17 +10,17 @@ import android.content.Intent;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import ru.vtosters.lite.proxy.http.CustomHttp;
|
||||
import ru.vtosters.lite.proxy.https.CustomHttps;
|
||||
import ru.vtosters.lite.proxy.socks.CustomSocks;
|
||||
import ru.vtosters.lite.proxy.RandomProxy;
|
||||
import ru.vtosters.lite.proxy.socks.Zaborona;
|
||||
|
||||
public class ProxyUtils {
|
||||
public static String getApi() {
|
||||
public class ProxyUtils{
|
||||
public static String getApi(){
|
||||
var proxyapi = getPrefsValue("proxyapi");
|
||||
|
||||
if (isApiProxyEnabled() & !proxyapi.isEmpty()) {
|
||||
@@ -31,23 +30,23 @@ public class ProxyUtils {
|
||||
return "api.vk.com";
|
||||
}
|
||||
|
||||
public static Boolean isZaboronaEnabled() {
|
||||
public static Boolean isZaboronaEnabled(){
|
||||
return getPrefsValue("proxy").equals("zaborona");
|
||||
}
|
||||
|
||||
public static Boolean isRandomProxyEnabled() {
|
||||
public static Boolean isRandomProxyEnabled(){
|
||||
return getPrefsValue("proxy").equals("randomproxy");
|
||||
}
|
||||
|
||||
public static Boolean isApiProxyEnabled() {
|
||||
public static Boolean isApiProxyEnabled(){
|
||||
return getPrefsValue("proxy").equals("apiproxy");
|
||||
}
|
||||
|
||||
public static Boolean isVikaProxyEnabled() {
|
||||
public static Boolean isVikaProxyEnabled(){
|
||||
return getPrefsValue("proxy").equals("vika");
|
||||
}
|
||||
|
||||
public static void forceProxyApplying() {
|
||||
public static void forceProxyApplying(){
|
||||
Log.d("Proxy", "Setting proxy...");
|
||||
try {
|
||||
var context = getGlobalContext().getApplicationContext();
|
||||
@@ -90,8 +89,12 @@ public class ProxyUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setProxy() {
|
||||
switch (getPrefsValue("proxy")) {
|
||||
public static boolean hasProxy(String list){
|
||||
return list.contains(":"); // proxy format: ip:port
|
||||
}
|
||||
|
||||
public static void setProxy() throws IOException{
|
||||
switch(getPrefsValue("proxy")) {
|
||||
case "zaborona":
|
||||
Zaborona.loadProxy();
|
||||
break;
|
||||
@@ -113,7 +116,7 @@ public class ProxyUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void resetProxy() {
|
||||
public static void resetProxy(){
|
||||
clearProperty("https.proxyHost");
|
||||
clearProperty("https.proxyPort");
|
||||
clearProperty("https.proxyUser");
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package ru.vtosters.lite.proxy;
|
||||
import java.io.IOException;
|
||||
|
||||
import ru.vtosters.lite.proxy.socks.Hookzof;
|
||||
import ru.vtosters.lite.proxy.socks.Jetkai;
|
||||
import ru.vtosters.lite.proxy.socks.Roosterkid;
|
||||
import ru.vtosters.lite.proxy.socks.TheSpeedX;
|
||||
|
||||
public class RandomProxy{
|
||||
public static void loadProxy(){
|
||||
public static void loadProxy() throws IOException{
|
||||
var random = new java.util.Random();
|
||||
var randomInt = random.nextInt(7);
|
||||
switch (randomInt){
|
||||
switch(randomInt) {
|
||||
case 0:
|
||||
Hookzof.loadProxy();
|
||||
break;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package ru.vtosters.lite.proxy.api;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isApiProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isVikaProxyEnabled;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isApiProxyEnabled;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class ApiProxy{
|
||||
public static String linkReplacer(String link) {
|
||||
public static String linkReplacer(String link){
|
||||
var vkapi = "api.vk.com";
|
||||
var oauth = "oauth.vk.com";
|
||||
var vkstatic = "static.vk.com";
|
||||
@@ -45,7 +45,7 @@ public class ApiProxy{
|
||||
return link;
|
||||
}
|
||||
|
||||
public static String getAwayPhpCom() {
|
||||
public static String getAwayPhpCom(){
|
||||
var proxyapi = getPrefsValue("proxyapi");
|
||||
|
||||
if (isApiProxyEnabled() & !proxyapi.isEmpty()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ru.vtosters.lite.proxy.http;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
|
||||
public class CustomHttp{
|
||||
public static void loadProxy(){
|
||||
@@ -11,22 +11,22 @@ public class CustomHttp{
|
||||
forceProxyApplying();
|
||||
}
|
||||
|
||||
private static String proxyHostHTTP() {
|
||||
private static String proxyHostHTTP(){
|
||||
var string = getPrefsValue("proxyHostHTTP");
|
||||
return string.isEmpty() ? "192.168.0.1" : string;
|
||||
}
|
||||
|
||||
private static String proxyPortHTTP() {
|
||||
private static String proxyPortHTTP(){
|
||||
var string = getPrefsValue("proxyPortHTTP");
|
||||
return string.isEmpty() ? "8888" : string;
|
||||
}
|
||||
|
||||
private static String proxyUserHTTP() {
|
||||
private static String proxyUserHTTP(){
|
||||
var string = getPrefsValue("proxyUserHTTP");
|
||||
return string.isEmpty() ? "" : string;
|
||||
}
|
||||
|
||||
private static String proxyPassHTTP() {
|
||||
private static String proxyPassHTTP(){
|
||||
var string = getPrefsValue("proxyPassHTTP");
|
||||
return string.isEmpty() ? "" : string;
|
||||
}
|
||||
|
||||
@@ -1,76 +1,35 @@
|
||||
package ru.vtosters.lite.proxy.http;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class Jetkai{
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
private static final String TAG = "Jetkai_Http";
|
||||
|
||||
public static void loadProxy() {
|
||||
Request link = new Request.a()
|
||||
.b("https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-http.txt")
|
||||
.a();
|
||||
public static void loadProxy() throws IOException{
|
||||
ArrayList<String> proxyList = getProxy("https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-http.txt", TAG);
|
||||
|
||||
mClient.a(link).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d("Jetkai", "Error while getting proxy: " + e);
|
||||
loadError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response){
|
||||
try {
|
||||
setData(response);
|
||||
} catch (NullPointerException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void setData(Response response) throws IOException{
|
||||
String resp = response.a().g();
|
||||
|
||||
if (!hasProxy(resp)) {
|
||||
Log.d("Jetkai", "No proxy found");
|
||||
if (proxyList == null) {
|
||||
Log.d(TAG, "No proxy found");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> proxyList = new ArrayList<>(Arrays.asList(resp.split("\n")));
|
||||
|
||||
Log.d("Jetkai", proxyList.toString());
|
||||
|
||||
String proxy = proxyList.get(new java.util.Random().nextInt(proxyList.size()));
|
||||
|
||||
if (!hasProxy(proxy)) {
|
||||
Log.d("Jetkai", "No proxy port found");
|
||||
Log.d(TAG, "No proxy port found");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d("Jetkai", "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
System.setProperty("http.proxyHost", proxy.split(":")[0]);
|
||||
System.setProperty("http.proxyPort", proxy.split(":")[1]);
|
||||
forceProxyApplying();
|
||||
}
|
||||
|
||||
static boolean hasProxy(String list) {
|
||||
return list.contains(":"); // proxy format: ip:port
|
||||
}
|
||||
|
||||
static void loadError() {
|
||||
sendToast("Error while getting proxy Jetkai");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,76 +1,35 @@
|
||||
package ru.vtosters.lite.proxy.http;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class TheSpeedX{
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
private static final String TAG = "TheSpeedX_Http";
|
||||
|
||||
public static void loadProxy() {
|
||||
Request link = new Request.a()
|
||||
.b("https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt")
|
||||
.a();
|
||||
public static void loadProxy() throws IOException{
|
||||
ArrayList<String> proxyList = getProxy("https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt", TAG);
|
||||
|
||||
mClient.a(link).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d("TheSpeedX", "Error while getting proxy: " + e);
|
||||
loadError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response){
|
||||
try {
|
||||
setData(response);
|
||||
} catch (NullPointerException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void setData(Response response) throws IOException{
|
||||
String resp = response.a().g();
|
||||
|
||||
if (!hasProxy(resp)) {
|
||||
Log.d("TheSpeedX", "No proxy found");
|
||||
if (proxyList == null) {
|
||||
Log.d(TAG, "No proxy found");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> proxyList = new ArrayList<>(Arrays.asList(resp.split("\n")));
|
||||
|
||||
Log.d("TheSpeedX", proxyList.toString());
|
||||
|
||||
String proxy = proxyList.get(new java.util.Random().nextInt(proxyList.size()));
|
||||
|
||||
if (!hasProxy(proxy)) {
|
||||
Log.d("TheSpeedX", "No proxy port found");
|
||||
Log.d(TAG, "No proxy port found");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d("TheSpeedX", "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
System.setProperty("http.proxyHost", proxy.split(":")[0]);
|
||||
System.setProperty("http.proxyPort", proxy.split(":")[1]);
|
||||
forceProxyApplying();
|
||||
}
|
||||
|
||||
static boolean hasProxy(String list) {
|
||||
return list.contains(":"); // proxy format: ip:port
|
||||
}
|
||||
|
||||
static void loadError() {
|
||||
sendToast("Error while getting proxy TheSpeedX");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ru.vtosters.lite.proxy.https;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
|
||||
public class CustomHttps{
|
||||
public static void loadProxy(){
|
||||
@@ -11,22 +11,22 @@ public class CustomHttps{
|
||||
forceProxyApplying();
|
||||
}
|
||||
|
||||
private static String proxyHostHTTPS() {
|
||||
private static String proxyHostHTTPS(){
|
||||
var string = getPrefsValue("proxyHostHTTPS");
|
||||
return string.isEmpty() ? "192.168.0.1" : string;
|
||||
}
|
||||
|
||||
private static String proxyPortHTTPS() {
|
||||
private static String proxyPortHTTPS(){
|
||||
var string = getPrefsValue("proxyPortHTTPS");
|
||||
return string.isEmpty() ? "8888" : string;
|
||||
}
|
||||
|
||||
private static String proxyUserHTTPS() {
|
||||
private static String proxyUserHTTPS(){
|
||||
var string = getPrefsValue("proxyUserHTTPS");
|
||||
return string.isEmpty() ? "" : string;
|
||||
}
|
||||
|
||||
private static String proxyPassHTTPS() {
|
||||
private static String proxyPassHTTPS(){
|
||||
String string = getPrefsValue("proxyPassHTTPS");
|
||||
return string.isEmpty() ? "" : string;
|
||||
}
|
||||
|
||||
@@ -1,76 +1,35 @@
|
||||
package ru.vtosters.lite.proxy.https;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class Jetkai{
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
private static final String TAG = "Jetkai_Https";
|
||||
|
||||
public static void loadProxy() {
|
||||
Request link = new Request.a()
|
||||
.b("https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-https.txt")
|
||||
.a();
|
||||
public static void loadProxy() throws IOException{
|
||||
ArrayList<String> proxyList = getProxy("https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-https.txt", TAG);
|
||||
|
||||
mClient.a(link).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d("Jetkai", "Error while getting proxy: " + e);
|
||||
loadError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response){
|
||||
try {
|
||||
setData(response);
|
||||
} catch (NullPointerException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void setData(Response response) throws IOException{
|
||||
String resp = response.a().g();
|
||||
|
||||
if (!hasProxy(resp)) {
|
||||
Log.d("Jetkai", "No proxy found");
|
||||
if (proxyList == null) {
|
||||
Log.d(TAG, "No proxy found");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> proxyList = new ArrayList<>(Arrays.asList(resp.split("\n")));
|
||||
|
||||
Log.d("Jetkai", proxyList.toString());
|
||||
|
||||
String proxy = proxyList.get(new java.util.Random().nextInt(proxyList.size()));
|
||||
|
||||
if (!hasProxy(proxy)) {
|
||||
Log.d("Jetkai", "No proxy port found");
|
||||
Log.d(TAG, "No proxy port found");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d("Jetkai", "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
System.setProperty("https.proxyHost", proxy.split(":")[0]);
|
||||
System.setProperty("https.proxyPort", proxy.split(":")[1]);
|
||||
forceProxyApplying();
|
||||
}
|
||||
|
||||
static boolean hasProxy(String list) {
|
||||
return list.contains(":"); // proxy format: ip:port
|
||||
}
|
||||
|
||||
static void loadError() {
|
||||
sendToast("Error while getting proxy Jetkai");
|
||||
}
|
||||
}
|
||||
@@ -1,77 +1,36 @@
|
||||
package ru.vtosters.lite.proxy.https;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class Roosterkid{
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
private static final String TAG = "Roosterkid_Https";
|
||||
|
||||
public static void loadProxy() {
|
||||
Request link = new Request.a()
|
||||
.b("https://raw.githubusercontent.com/roosterkid/openproxylist/main/HTTPS_RAW.txt")
|
||||
.a();
|
||||
public static void loadProxy() throws IOException{
|
||||
ArrayList<String> proxyList = getProxy("https://raw.githubusercontent.com/roosterkid/openproxylist/main/HTTPS_RAW.txt", TAG);
|
||||
|
||||
mClient.a(link).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d("Roosterkid", "Error while getting proxy: " + e);
|
||||
loadError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response){
|
||||
try {
|
||||
setData(response);
|
||||
} catch (NullPointerException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void setData(Response response) throws IOException{
|
||||
String resp = response.a().g();
|
||||
|
||||
if (!hasProxy(resp)) {
|
||||
Log.d("Roosterkid", "No proxy found");
|
||||
if (proxyList == null) {
|
||||
Log.d(TAG, "No proxy found");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> proxyList = new ArrayList<>(Arrays.asList(resp.split("\n")));
|
||||
|
||||
Log.d("Roosterkid", proxyList.toString());
|
||||
|
||||
String proxy = proxyList.get(new java.util.Random().nextInt(proxyList.size()));
|
||||
|
||||
if (!hasProxy(proxy)) {
|
||||
Log.d("Roosterkid", "No proxy port found");
|
||||
Log.d(TAG, "No proxy port found");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d("Roosterkid", "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
System.setProperty("https.proxyHost", proxy.split(":")[0]);
|
||||
System.setProperty("https.proxyPort", proxy.split(":")[1]);
|
||||
forceProxyApplying();
|
||||
}
|
||||
|
||||
static boolean hasProxy(String list) {
|
||||
return list.contains(":"); // proxy format: ip:port
|
||||
}
|
||||
|
||||
static void loadError() {
|
||||
sendToast("Error while getting proxy Roosterkid");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package ru.vtosters.lite.proxy.socks;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
|
||||
public class CustomSocks{
|
||||
public static void loadProxy(){
|
||||
@@ -9,12 +9,12 @@ public class CustomSocks{
|
||||
forceProxyApplying();
|
||||
}
|
||||
|
||||
private static String proxyHostSocks() {
|
||||
private static String proxyHostSocks(){
|
||||
var string = getPrefsValue("proxyHostSocks");
|
||||
return string.isEmpty() ? "192.168.0.1" : string;
|
||||
}
|
||||
|
||||
private static String proxyPortSocks() {
|
||||
private static String proxyPortSocks(){
|
||||
var string = getPrefsValue("proxyPortSocks");
|
||||
return string.isEmpty() ? "8888" : string;
|
||||
}
|
||||
|
||||
@@ -1,76 +1,35 @@
|
||||
package ru.vtosters.lite.proxy.socks;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class Hookzof{
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
private static final String TAG = "Hookzof_Socks";
|
||||
|
||||
public static void loadProxy() {
|
||||
Request link = new Request.a()
|
||||
.b("https://raw.githubusercontent.com/hookzof/socks5_list/master/proxy.txt")
|
||||
.a();
|
||||
public static void loadProxy() throws IOException{
|
||||
ArrayList<String> proxyList = getProxy("https://raw.githubusercontent.com/hookzof/socks5_list/master/proxy.txt", TAG);
|
||||
|
||||
mClient.a(link).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d("Hookzof", "Error while getting proxy: " + e);
|
||||
loadError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response){
|
||||
try {
|
||||
setData(response);
|
||||
} catch (NullPointerException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void setData(Response response) throws IOException{
|
||||
String resp = response.a().g();
|
||||
|
||||
if (!hasProxy(resp)) {
|
||||
Log.d("Hookzof", "No proxy found");
|
||||
if (proxyList == null) {
|
||||
Log.d(TAG, "No proxy found");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> proxyList = new ArrayList<>(Arrays.asList(resp.split("\n")));
|
||||
|
||||
Log.d("Hookzof", proxyList.toString());
|
||||
|
||||
String proxy = proxyList.get(new java.util.Random().nextInt(proxyList.size()));
|
||||
|
||||
if (!hasProxy(proxy)) {
|
||||
Log.d("Hookzof", "No proxy port found");
|
||||
Log.d(TAG, "No proxy port found");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d("Hookzof", "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
System.setProperty("socksProxyHost", proxy.split(":")[0]);
|
||||
System.setProperty("socksProxyPort", proxy.split(":")[1]);
|
||||
forceProxyApplying();
|
||||
}
|
||||
|
||||
static boolean hasProxy(String list) {
|
||||
return list.contains(":"); // proxy format: ip:port
|
||||
}
|
||||
|
||||
static void loadError() {
|
||||
sendToast("Error while getting proxy Hookzof");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,76 +1,35 @@
|
||||
package ru.vtosters.lite.proxy.socks;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class Jetkai{
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
private static final String TAG = "Jetkai_Socks";
|
||||
|
||||
public static void loadProxy() {
|
||||
Request link = new Request.a()
|
||||
.b("https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks5.txt")
|
||||
.a();
|
||||
public static void loadProxy() throws IOException{
|
||||
ArrayList<String> proxyList = getProxy("https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks5.txt", TAG);
|
||||
|
||||
mClient.a(link).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d("Jetkai", "Error while getting proxy: " + e);
|
||||
loadError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response){
|
||||
try {
|
||||
setData(response);
|
||||
} catch (NullPointerException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void setData(Response response) throws IOException{
|
||||
String resp = response.a().g();
|
||||
|
||||
if (!hasProxy(resp)) {
|
||||
Log.d("Jetkai", "No proxy found");
|
||||
if (proxyList == null) {
|
||||
Log.d(TAG, "No proxy found");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> proxyList = new ArrayList<>(Arrays.asList(resp.split("\n")));
|
||||
|
||||
Log.d("Jetkai", proxyList.toString());
|
||||
|
||||
String proxy = proxyList.get(new java.util.Random().nextInt(proxyList.size()));
|
||||
|
||||
if (!hasProxy(proxy)) {
|
||||
Log.d("Jetkai", "No proxy port found");
|
||||
Log.d(TAG, "No proxy port found");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d("Jetkai", "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
System.setProperty("socksProxyHost", proxy.split(":")[0]);
|
||||
System.setProperty("socksProxyPort", proxy.split(":")[1]);
|
||||
forceProxyApplying();
|
||||
}
|
||||
|
||||
static boolean hasProxy(String list) {
|
||||
return list.contains(":"); // proxy format: ip:port
|
||||
}
|
||||
|
||||
static void loadError() {
|
||||
sendToast("Error while getting proxy Jetkai");
|
||||
}
|
||||
}
|
||||
@@ -1,76 +1,35 @@
|
||||
package ru.vtosters.lite.proxy.socks;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class Roosterkid{
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
private static final String TAG = "Roosterkid_Socks";
|
||||
|
||||
public static void loadProxy() {
|
||||
Request link = new Request.a()
|
||||
.b("https://raw.githubusercontent.com/roosterkid/openproxylist/main/SOCKS5_RAW.txt")
|
||||
.a();
|
||||
public static void loadProxy() throws IOException{
|
||||
ArrayList<String> proxyList = getProxy("https://raw.githubusercontent.com/roosterkid/openproxylist/main/SOCKS5_RAW.txt", TAG);
|
||||
|
||||
mClient.a(link).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d("Roosterkid", "Error while getting proxy: " + e);
|
||||
loadError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response){
|
||||
try {
|
||||
setData(response);
|
||||
} catch (NullPointerException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void setData(Response response) throws IOException{
|
||||
String resp = response.a().g();
|
||||
|
||||
if (!hasProxy(resp)) {
|
||||
Log.d("Roosterkid", "No proxy found");
|
||||
if (proxyList == null) {
|
||||
Log.d(TAG, "No proxy found");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> proxyList = new ArrayList<>(Arrays.asList(resp.split("\n")));
|
||||
|
||||
Log.d("Roosterkid", proxyList.toString());
|
||||
|
||||
String proxy = proxyList.get(new java.util.Random().nextInt(proxyList.size()));
|
||||
|
||||
if (!hasProxy(proxy)) {
|
||||
Log.d("Roosterkid", "No proxy port found");
|
||||
Log.d(TAG, "No proxy port found");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d("Roosterkid", "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
System.setProperty("socksProxyHost", proxy.split(":")[0]);
|
||||
System.setProperty("socksProxyPort", proxy.split(":")[1]);
|
||||
forceProxyApplying();
|
||||
}
|
||||
|
||||
static boolean hasProxy(String list) {
|
||||
return list.contains(":"); // proxy format: ip:port
|
||||
}
|
||||
|
||||
static void loadError() {
|
||||
sendToast("Error while getting proxy Roosterkid");
|
||||
}
|
||||
}
|
||||
@@ -1,76 +1,35 @@
|
||||
package ru.vtosters.lite.proxy.socks;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class TheSpeedX{
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
private static final String TAG = "TheSpeedX_Socks";
|
||||
|
||||
public static void loadProxy() {
|
||||
Request link = new Request.a()
|
||||
.b("https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks5.txt")
|
||||
.a();
|
||||
public static void loadProxy() throws IOException{
|
||||
ArrayList<String> proxyList = getProxy("https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks5.txt", TAG);
|
||||
|
||||
mClient.a(link).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d("TheSpeedX", "Error while getting proxy: " + e);
|
||||
loadError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response){
|
||||
try {
|
||||
setData(response);
|
||||
} catch (NullPointerException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void setData(Response response) throws IOException{
|
||||
String resp = response.a().g();
|
||||
|
||||
if (!hasProxy(resp)) {
|
||||
Log.d("TheSpeedX", "No proxy found");
|
||||
if (proxyList == null) {
|
||||
Log.d(TAG, "No proxy found");
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> proxyList = new ArrayList<>(Arrays.asList(resp.split("\n")));
|
||||
|
||||
Log.d("TheSpeedX", proxyList.toString());
|
||||
|
||||
String proxy = proxyList.get(new java.util.Random().nextInt(proxyList.size()));
|
||||
|
||||
if (!hasProxy(proxy)) {
|
||||
Log.d("TheSpeedX", "No proxy port found");
|
||||
Log.d(TAG, "No proxy port found");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d("TheSpeedX", "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
System.setProperty("socksProxyHost", proxy.split(":")[0]);
|
||||
System.setProperty("socksProxyPort", proxy.split(":")[1]);
|
||||
forceProxyApplying();
|
||||
}
|
||||
|
||||
static boolean hasProxy(String list) {
|
||||
return list.contains(":"); // proxy format: ip:port
|
||||
}
|
||||
|
||||
static void loadError() {
|
||||
sendToast("Error while getting proxy TheSpeedX");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user