1
1
mirror of https://github.com/angristan/wireguard-install.git synced 2024-10-31 18:52:31 +00:00

Handle IPv6 format for server endpoint

Fix https://github.com/angristan/wireguard-install/issues/352
This commit is contained in:
Stanislas Lange 2023-01-22 15:25:13 +01:00
parent d7b8cd9948
commit c97e3cc6b3
No known key found for this signature in database

View File

@ -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 ""