|
23 | 23 | import androidx.core.app.NotificationCompat;
|
24 | 24 | import androidx.core.app.NotificationManagerCompat;
|
25 | 25 |
|
26 |
| -import okhttp3.OkHttpClient; |
27 |
| -import okhttp3.Request; |
28 |
| -import okhttp3.Response; |
29 | 26 | import tun2socks.Tun2socks;
|
30 | 27 | import tun2socks.StartOptions;
|
31 | 28 |
|
32 | 29 | import java.io.FileOutputStream;
|
33 | 30 | import java.io.IOException;
|
34 | 31 | import java.lang.ref.WeakReference;
|
35 |
| -import java.net.InetSocketAddress; |
36 |
| -import java.net.Proxy; |
37 | 32 | import java.net.ServerSocket;
|
38 | 33 | import java.util.HashMap;
|
39 | 34 | import java.util.Map;
|
40 |
| -import java.util.Objects; |
41 |
| -import java.util.concurrent.TimeUnit; |
42 | 35 |
|
43 | 36 | public class OblivionVpnService extends VpnService {
|
44 | 37 | private static final String TAG = "oblivionVPN";
|
@@ -135,39 +128,6 @@ public static Map<String, Integer> splitHostAndPort(String hostPort) {
|
135 | 128 | return result;
|
136 | 129 | }
|
137 | 130 |
|
138 |
| - |
139 |
| - public static String pingOverHTTP(String bindAddress) { |
140 |
| - Map<String, Integer> result = splitHostAndPort(bindAddress); |
141 |
| - if (result == null) { |
142 |
| - return "exception"; |
143 |
| - } |
144 |
| - String socksHost = result.keySet().iterator().next(); |
145 |
| - int socksPort = result.values().iterator().next(); |
146 |
| - |
147 |
| - // Set up the SOCKS proxy |
148 |
| - Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(socksHost, socksPort)); |
149 |
| - |
150 |
| - // Create OkHttpClient with SOCKS proxy |
151 |
| - OkHttpClient client = new OkHttpClient.Builder() |
152 |
| - .proxy(proxy) |
153 |
| - .connectTimeout(5, TimeUnit.SECONDS) // 5 seconds connection timeout |
154 |
| - .readTimeout(5, TimeUnit.SECONDS) // 5 seconds read timeout |
155 |
| - .build(); |
156 |
| - |
157 |
| - // Build the request |
158 |
| - Request request = new Request.Builder() |
159 |
| - .url("https://1.1.1.1") // Replace with actual URL |
160 |
| - .build(); |
161 |
| - |
162 |
| - // Execute the request |
163 |
| - try (Response response = client.newCall(request).execute()) { |
164 |
| - return response.isSuccessful() ? "true" : "false"; |
165 |
| - } catch (IOException e) { |
166 |
| - //e.printStackTrace(); |
167 |
| - return Objects.requireNonNull(e.getMessage()).contains("ECONNREFUSED") || e.getMessage().contains("general failure") || e.getMessage().contains("timed out") ? "false" : "exception"; |
168 |
| - } |
169 |
| - } |
170 |
| - |
171 | 131 | private static int findFreePort() {
|
172 | 132 | ServerSocket socket = null;
|
173 | 133 | try {
|
@@ -473,7 +433,7 @@ private void createNotification() {
|
473 | 433 | this, 2, new Intent(this, MainActivity.class), PendingIntent.FLAG_IMMUTABLE);
|
474 | 434 | notification = new NotificationCompat.Builder(this, notificationChannel.getId())
|
475 | 435 | .setContentTitle("Vpn service")
|
476 |
| - .setContentText("Testing Tun2Socks") |
| 436 | + .setContentText("Oblivion WARP") |
477 | 437 | .setSmallIcon(R.mipmap.ic_launcher)
|
478 | 438 | .setOnlyAlertOnce(true)
|
479 | 439 | .setOngoing(true)
|
|
0 commit comments