aboutsummaryrefslogtreecommitdiff
path: root/wireguard-install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'wireguard-install.sh')
-rw-r--r--wireguard-install.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/wireguard-install.sh b/wireguard-install.sh
index e8f594b..79dd829 100644
--- a/wireguard-install.sh
+++ b/wireguard-install.sh
@@ -273,6 +273,12 @@ net.ipv6.conf.all.forwarding = 1" >/etc/sysctl.d/wg.conf
}
function newClient() {
+ # If SERVER_PUB_IP is IPv6, add brackets if missing
+ if [[ ${SERVER_PUB_IP} =~ .*:.* ]]; then
+ if [[ ${SERVER_PUB_IP} != *"["* ]] || [[ ${SERVER_PUB_IP} != *"]"* ]]; then
+ SERVER_PUB_IP="[${SERVER_PUB_IP}]"
+ fi
+ fi
ENDPOINT="${SERVER_PUB_IP}:${SERVER_PORT}"
echo ""