diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-02-24 21:43:07 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-02-24 21:43:07 +0100 |
commit | 1dbe14aefa8afd7513f6ae3b12e13044d48c684a (patch) | |
tree | 7a64bf536a109b75684993cdfb8db15fa0b6668e | |
parent | 11ed3d7f07914ab48b086974fc77d5ae720f1496 (diff) |
WIP: enable proxy
-rw-r--r-- | tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java index 375de1f2..f2eb86da 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -529,21 +529,21 @@ public final class GoBackend implements Backend { service.setUnderlyingNetworks(null); Log.i(TAG, "Builder 14"); - // Optional<HttpProxy> proxy = config.getInterface().getHttpProxy(); - // if (proxy.isPresent()) { - // ProxyInfo pi = proxy.get().getProxyInfo(); - // Uri pacFileUrl = pi.getPacFileUrl(); - - // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - // if (pacFileUrl != null && pacFileUrl != Uri.EMPTY) { - // int listenPort = startHttpProxy(pacFileUrl); - // ProxyInfo localPi = ProxyInfo.buildDirectProxy("localhost", listenPort); - // builder.setHttpProxy(localPi); - // } else { - // builder.setHttpProxy(pi); - // } - // } - // } + Optional<HttpProxy> proxy = config.getInterface().getHttpProxy(); + if (proxy.isPresent()) { + ProxyInfo pi = proxy.get().getProxyInfo(); + Uri pacFileUrl = pi.getPacFileUrl(); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + if (pacFileUrl != null && pacFileUrl != Uri.EMPTY) { + int listenPort = startHttpProxy(pacFileUrl); + ProxyInfo localPi = ProxyInfo.buildDirectProxy("localhost", listenPort); + builder.setHttpProxy(localPi); + } else { + builder.setHttpProxy(pi); + } + } + } Log.i(TAG, "Builder 15"); builder.setBlocking(true); |