made publicip function faster by using dig

This commit is contained in:
Andrew Titmuss 2016-03-19 13:38:48 +11:00
parent 438a3a2978
commit 5b9466cfec

View file

@ -1659,7 +1659,10 @@ getlocalip () {
}
getpublicip () {
if type -p curl >/dev/null 2>&1; then
if type -p dig >/dev/null 2>&1; then
publicip="$(dig +short myip.opendns.com @resolver1.opendns.com)"
elif type -p curl >/dev/null 2>&1; then
publicip="$(curl -w '\n' "$public_ip_host")"
elif type -p wget >/dev/null 2>&1; then