diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-03-11 23:10:42 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-10-26 22:25:47 +0200 |
commit | f533b5c185fb96f78623b4f80b42782dab6bdbcb (patch) | |
tree | 418f4591e25f3a4939a1fc7a603950fa0a2979fa /tunnel/src/main/java/com/wireguard/android | |
parent | 1d5070130ae9c33bb2057f4defedc67a9e3f123a (diff) |
WIP: Add TrafficStats
Diffstat (limited to 'tunnel/src/main/java/com/wireguard/android')
-rw-r--r-- | tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java | 3 |
1 files changed, 3 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 6e8d565c..f2fa8342 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -15,6 +15,7 @@ import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkRequest; import android.net.ProxyInfo; +import android.net.TrafficStats; import android.net.Uri; import android.os.Build; import android.os.ParcelFileDescriptor; @@ -99,6 +100,7 @@ import androidx.collection.ArraySet; public final class GoBackend implements Backend { private static final int DNS_RESOLUTION_RETRIES = 10; private static final String TAG = "WireGuard/GoBackend"; + private static final int STATS_TAG = 2; @Nullable private static AlwaysOnCallback alwaysOnCallback; private static GhettoCompletableFuture<VpnService> vpnService = new GhettoCompletableFuture<>(); private final Context context; @@ -305,6 +307,7 @@ public final class GoBackend implements Backend { StringBuffer buf = new StringBuffer(); try { URL url = new URL(pacFileUrl.toString()); + TrafficStats.setThreadStatsTag(STATS_TAG); urlConnection = (HttpURLConnection) network.openConnection(url); InputStream in = urlConnection.getInputStream(); |