mirror of
https://github.com/angristan/wireguard-install.git
synced 2024-11-24 05:56:02 +03:00
Merge branch 'master' into master
This commit is contained in:
commit
25f93b8b9d
@ -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)
|
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 "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
|
# Detect public interface and pre-fill for the user
|
||||||
SERVER_PUB_NIC="$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)"
|
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
|
read -rp "Public interface: " -e -i "$SERVER_PUB_NIC" SERVER_PUB_NIC
|
||||||
@ -72,9 +70,12 @@ read -rp "Second DNS resolver to use for the client: " -e -i "$CLIENT_DNS_2" CLI
|
|||||||
# Ask for pre-shared symmetric key
|
# Ask for pre-shared symmetric key
|
||||||
read -rp "Want to use pre-shared symmetric key? [y/N] " is_pre_symm
|
read -rp "Want to use pre-shared symmetric key? [y/N] " is_pre_symm
|
||||||
|
|
||||||
if [[ $SERVER_PUB_IPV6_USED = 'y' ]]; then
|
if [[ $SERVER_PUB_IP =~ .*:.* ]]
|
||||||
|
then
|
||||||
|
echo "IPv6 Detected"
|
||||||
ENDPOINT="[$SERVER_PUB_IP]:$SERVER_PORT"
|
ENDPOINT="[$SERVER_PUB_IP]:$SERVER_PORT"
|
||||||
else
|
else
|
||||||
|
echo "IPv4 Detected"
|
||||||
ENDPOINT="$SERVER_PUB_IP:$SERVER_PORT"
|
ENDPOINT="$SERVER_PUB_IP:$SERVER_PORT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user