diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-02-24 21:43:07 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-03-30 23:17:27 +0200 |
commit | b4fd9e3519a780255ad7ddfbfbcf3f32cf0fb2aa (patch) | |
tree | 15be48cf3d5388380d39f1814e5af5bd15da56f6 /tunnel | |
parent | 0c433357ff731d2824753f453fd477c12ae3d40c (diff) |
WIP: enable proxy
Diffstat (limited to 'tunnel')
-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 b5b81ebc..90dd7534 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -526,21 +526,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); |