diff options
author | Luca Lacerda <lucalacerda1@gmail.com> | 2019-06-08 03:36:54 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-08 03:36:54 -0300 |
commit | 25f93b8b9db9b391aab068f1a0abf2a64e114096 (patch) | |
tree | 3d36b06229526e2d251f2eecc363922667374d4b /wireguard-install.sh | |
parent | a09de9c57adce50bc3f76c3eeee4d8aee94b9883 (diff) | |
parent | cee0b88b2b6d7aa4827e1df5374fca0a97614b9c (diff) |
Merge branch 'master' into master
Diffstat (limited to 'wireguard-install.sh')
-rw-r--r-- | wireguard-install.sh | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/wireguard-install.sh b/wireguard-install.sh index 1dc8f21..cbb9309 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -38,8 +38,6 @@ fi SERVER_PUB_IPV4=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1) read -rp "IPv4 or IPv6 public address: " -e -i "$SERVER_PUB_IPV4" SERVER_PUB_IP -read -rp "Did you enter an IPv6 address? (y/n) " -e -i n SERVER_PUB_IPV6_USED - # Detect public interface and pre-fill for the user SERVER_PUB_NIC="$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)" read -rp "Public interface: " -e -i "$SERVER_PUB_NIC" SERVER_PUB_NIC @@ -72,10 +70,13 @@ read -rp "Second DNS resolver to use for the client: " -e -i "$CLIENT_DNS_2" CLI # Ask for pre-shared symmetric key read -rp "Want to use pre-shared symmetric key? [y/N] " is_pre_symm -if [[ $SERVER_PUB_IPV6_USED = 'y' ]]; then - ENDPOINT="[$SERVER_PUB_IP]:$SERVER_PORT" +if [[ $SERVER_PUB_IP =~ .*:.* ]] +then + echo "IPv6 Detected" + ENDPOINT="[$SERVER_PUB_IP]:$SERVER_PORT" else - ENDPOINT="$SERVER_PUB_IP:$SERVER_PORT" + echo "IPv4 Detected" + ENDPOINT="$SERVER_PUB_IP:$SERVER_PORT" fi # Install WireGuard tools and module |