summaryrefslogtreecommitdiffhomepage
path: root/tunnel/src/main/java/com/wireguard/android
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2021-12-19 02:33:12 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-10-26 00:11:00 +0200
commitd4d4fa146ace9adde109cd7fcf02c283926ffb3e (patch)
tree0576d03831577e14195566f2e8e4dd2c61cd5ab6 /tunnel/src/main/java/com/wireguard/android
parent4ba87947ae3346280da76e13ef6981a631e43c3c (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.java6
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)