summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/com/wireguard/config/Peer.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/config/Peer.java b/app/src/main/java/com/wireguard/config/Peer.java
index 49c8b70e..b65f52cb 100644
--- a/app/src/main/java/com/wireguard/config/Peer.java
+++ b/app/src/main/java/com/wireguard/config/Peer.java
@@ -71,7 +71,10 @@ public class Peer {
private String getEndpointString() {
if (endpoint == null)
return null;
- return String.format("%s:%d", endpoint.getHostString(), endpoint.getPort());
+ if (endpoint.getHostString().contains(":") && !endpoint.getHostString().contains("["))
+ return String.format("[%s]:%d", endpoint.getHostString(), endpoint.getPort());
+ else
+ return String.format("%s:%d", endpoint.getHostString(), endpoint.getPort());
}
public int getPersistentKeepalive() {