summaryrefslogtreecommitdiffhomepage
path: root/tunnel/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'tunnel/src/main/java/com')
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java4
-rw-r--r--tunnel/src/main/java/com/wireguard/config/Attribute.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/config/InetEndpoint.java7
-rw-r--r--tunnel/src/main/java/com/wireguard/config/Interface.java14
-rw-r--r--tunnel/src/main/java/com/wireguard/config/Peer.java2
5 files changed, 11 insertions, 19 deletions
diff --git a/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java b/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java
index d4d1f152..e2d87653 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java
@@ -32,8 +32,6 @@ import java.util.Objects;
import java.util.Set;
import androidx.annotation.Nullable;
-import java9.util.stream.Collectors;
-import java9.util.stream.Stream;
/**
* WireGuard backend that uses {@code wg-quick} to implement tunnel configuration.
@@ -67,7 +65,7 @@ public final class WgQuickBackend implements Backend {
return Collections.emptySet();
}
// wg puts all interface names on the same line. Split them into separate elements.
- return Stream.of(output.get(0).split(" ")).collect(Collectors.toUnmodifiableSet());
+ return Set.of(output.get(0).split(" "));
}
@Override
diff --git a/tunnel/src/main/java/com/wireguard/config/Attribute.java b/tunnel/src/main/java/com/wireguard/config/Attribute.java
index 659f7cf4..447d7216 100644
--- a/tunnel/src/main/java/com/wireguard/config/Attribute.java
+++ b/tunnel/src/main/java/com/wireguard/config/Attribute.java
@@ -8,11 +8,10 @@ package com.wireguard.config;
import com.wireguard.util.NonNullForAll;
import java.util.Iterator;
+import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java9.util.Optional;
-
@NonNullForAll
public final class Attribute {
private static final Pattern LINE_PATTERN = Pattern.compile("(\\w+)\\s*=\\s*([^\\s#][^#]*)");
diff --git a/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java b/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java
index 6eff4a1b..87a4b9d0 100644
--- a/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java
+++ b/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java
@@ -7,18 +7,17 @@ package com.wireguard.config;
import com.wireguard.util.NonNullForAll;
-import org.threeten.bp.Duration;
-import org.threeten.bp.Instant;
-
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.Optional;
import java.util.regex.Pattern;
import androidx.annotation.Nullable;
-import java9.util.Optional;
/**
diff --git a/tunnel/src/main/java/com/wireguard/config/Interface.java b/tunnel/src/main/java/com/wireguard/config/Interface.java
index c49357f7..01bb3699 100644
--- a/tunnel/src/main/java/com/wireguard/config/Interface.java
+++ b/tunnel/src/main/java/com/wireguard/config/Interface.java
@@ -20,13 +20,11 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
+import java.util.stream.Collectors;
import androidx.annotation.Nullable;
-import java9.util.Lists;
-import java9.util.Optional;
-import java9.util.stream.Collectors;
-import java9.util.stream.StreamSupport;
/**
* Represents the configuration for a WireGuard interface (an [Interface] block). Interfaces must
@@ -223,9 +221,7 @@ public final class Interface {
if (!addresses.isEmpty())
sb.append("Address = ").append(Attribute.join(addresses)).append('\n');
if (!dnsServers.isEmpty()) {
- final List<String> dnsServerStrings = StreamSupport.stream(dnsServers)
- .map(InetAddress::getHostAddress)
- .collect(Collectors.toUnmodifiableList());
+ final List<String> dnsServerStrings = dnsServers.stream().map(InetAddress::getHostAddress).collect(Collectors.toList());
sb.append("DNS = ").append(Attribute.join(dnsServerStrings)).append('\n');
}
if (!excludedApplications.isEmpty())
@@ -339,11 +335,11 @@ public final class Interface {
}
public Builder parseExcludedApplications(final CharSequence apps) {
- return excludeApplications(Lists.of(Attribute.split(apps)));
+ return excludeApplications(List.of(Attribute.split(apps)));
}
public Builder parseIncludedApplications(final CharSequence apps) {
- return includeApplications(Lists.of(Attribute.split(apps)));
+ return includeApplications(List.of(Attribute.split(apps)));
}
public Builder parseListenPort(final String listenPort) throws BadConfigException {
diff --git a/tunnel/src/main/java/com/wireguard/config/Peer.java b/tunnel/src/main/java/com/wireguard/config/Peer.java
index 984dbe9c..b9824bff 100644
--- a/tunnel/src/main/java/com/wireguard/config/Peer.java
+++ b/tunnel/src/main/java/com/wireguard/config/Peer.java
@@ -17,10 +17,10 @@ import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
import androidx.annotation.Nullable;
-import java9.util.Optional;
/**
* Represents the configuration for a WireGuard peer (a [Peer] block). Peers must have a public key,