diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-12-19 02:33:12 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-05-10 21:07:43 +0200 |
commit | 6b355bd9161e72452a98a8677d697de75978fcd3 (patch) | |
tree | 12031d97e393a9384a61d513a0f775454b2558c0 /tunnel/src/main/java/com/wireguard/android | |
parent | 8671acc1a629c6fed2eed6c313e06d5d50f65015 (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 429cb1f1..242f81d8 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.time.Instant; import java.util.Collections; import java.util.Set; @@ -318,6 +320,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) |