mirror of
https://github.com/angristan/openvpn-install.git
synced 2025-02-05 13:11:33 +01:00
add an option to use two option for detect public IP
This commit is contained in:
parent
908bffdb5b
commit
8d84eebd79
@ -227,8 +227,14 @@ function installQuestions() {
|
|||||||
echo "I need to know the IPv4 address of the network interface you want OpenVPN listening to."
|
echo "I need to know the IPv4 address of the network interface you want OpenVPN listening to."
|
||||||
echo "Unless your server is behind NAT, it should be your public IPv4 address."
|
echo "Unless your server is behind NAT, it should be your public IPv4 address."
|
||||||
|
|
||||||
# Detect public IPv4 address and pre-fill for the user
|
# If detect_from_net is not set detect the IP from the network
|
||||||
IP=$(ip -4 addr | sed -ne 's|^.* inet \([^/]*\)/.* scope global.*$|\1|p' | head -1)
|
# Else use this command to detect ip: curl -s https://api.ipify.org
|
||||||
|
if [[ -z $DETECT_FROM_NET ]]; then
|
||||||
|
# Detect public IPv4 address and pre-fill for the user
|
||||||
|
IP=$(ip -4 addr | sed -ne 's|^.* inet \([^/]*\)/.* scope global.*$|\1|p' | head -1)
|
||||||
|
else
|
||||||
|
IP=$(curl -s https://api.ipify.org)
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z $IP ]]; then
|
if [[ -z $IP ]]; then
|
||||||
# Detect public IPv6 address
|
# Detect public IPv6 address
|
||||||
|
Loading…
x
Reference in New Issue
Block a user