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-23 22:55:18 +0100 |
commit | 045e875d9c49334a2cf48f01116edac8bfcfb9b1 (patch) | |
tree | 36cce6ddb279cc4775c10267000d05f5062e224b | |
parent | 2220e2c5feadd55fde0f8ebde822657a866af792 (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 87886798..c4c72459 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); |