summaryrefslogtreecommitdiffhomepage
path: root/tunnel/src/main/java/com/wireguard/util/Resolver.java
diff options
context:
space:
mode:
Diffstat (limited to 'tunnel/src/main/java/com/wireguard/util/Resolver.java')
-rw-r--r--tunnel/src/main/java/com/wireguard/util/Resolver.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/tunnel/src/main/java/com/wireguard/util/Resolver.java b/tunnel/src/main/java/com/wireguard/util/Resolver.java
index 301e03e0..654e01f5 100644
--- a/tunnel/src/main/java/com/wireguard/util/Resolver.java
+++ b/tunnel/src/main/java/com/wireguard/util/Resolver.java
@@ -17,6 +17,7 @@ import java.net.UnknownHostException;
import android.net.IpPrefix;
import android.net.LinkProperties;
import android.net.Network;
+import android.net.TrafficStats;
import android.util.Log;
import androidx.annotation.Nullable;
@@ -24,6 +25,7 @@ import androidx.annotation.Nullable;
@NonNullForAll
public class Resolver {
private static final String TAG = "WireGuard/Resolver";
+ private static final int STATS_TAG = 3; // FIXME
@Nullable private final Network network;
@Nullable private final LinkProperties linkProps;
@Nullable private IpPrefix nat64Prefix;
@@ -82,6 +84,7 @@ public class Resolver {
}
public InetAddress resolve(String host) throws UnknownHostException {
+ TrafficStats.setThreadStatsTag(STATS_TAG);
final InetAddress[] candidates = network != null ? network.getAllByName(host) : InetAddress.getAllByName(host);
InetAddress address = candidates[0];
for (final InetAddress candidate : candidates) {
@@ -89,6 +92,7 @@ public class Resolver {
try {
sock = new DatagramSocket();
+ TrafficStats.tagDatagramSocket(sock);
if (network != null) {
network.bindSocket(sock);
}