Merge pull request #442 from iandrewt/publicip

Fix connection timed out with public_ip (dig)
This commit is contained in:
Dylan Araps 2016-11-17 15:05:44 +11:00 committed by GitHub
commit 2f2bcf87e9
1 changed files with 1 additions and 0 deletions

View File

@ -1700,6 +1700,7 @@ get_local_ip() {
get_public_ip() {
if type -p dig >/dev/null; then
public_ip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com)"
[[ "$public_ip" =~ ^\; ]] && unset public_ip
fi
if [[ -z "$public_ip" ]] && type -p curl >/dev/null; then