diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-12-19 02:33:12 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-04-04 23:05:25 +0200 |
commit | 2927f0205a152683789d772ffb1dba06ee6f81d5 (patch) | |
tree | 670921451ca8f0fb31c38911736baea15a2d90c5 /tunnel/src/main/java/com/wireguard/android | |
parent | 91a75b681d76a863e28db7c14ff1ffd215698997 (diff) |
ui,tunnel: add HTTP proxy setting to Go backend
Only make the HTTP proxy settings visible on supported Android versions,
i.e. Android 10 (AKA Android Q) and later.
Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
Diffstat (limited to 'tunnel/src/main/java/com/wireguard/android')
-rw-r--r-- | tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java | 6 |
1 files changed, 6 insertions, 0 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 ef06ebe7..00a528f2 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -7,6 +7,7 @@ package com.wireguard.android.backend; import android.content.Context; import android.content.Intent; +import android.net.ProxyInfo; import android.os.Build; import android.os.ParcelFileDescriptor; import android.system.OsConstants; @@ -24,6 +25,7 @@ import com.wireguard.crypto.KeyFormatException; import com.wireguard.util.NonNullForAll; import java.net.InetAddress; +import java.net.URL; import java.util.Collections; import java.util.Set; import java.util.concurrent.ExecutionException; @@ -299,6 +301,10 @@ public final class GoBackend implements Backend { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) service.setUnderlyingNetworks(null); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + config.getInterface().getHttpProxy().ifPresent(pi -> builder.setHttpProxy(pi.getProxyInfo())); + } + builder.setBlocking(true); try (final ParcelFileDescriptor tun = builder.establish()) { if (tun == null) |