Unverified Commit 614a2d1b authored by black's avatar black Committed by GitHub

Merge pull request #1254 from vaygr/public-ip-drill

Retrieve public IP info via drill
parents 99f6ccd3 85c6a5dd
...@@ -3371,6 +3371,11 @@ get_public_ip() { ...@@ -3371,6 +3371,11 @@ get_public_ip() {
[[ "$public_ip" =~ ^\; ]] && unset public_ip [[ "$public_ip" =~ ^\; ]] && unset public_ip
fi fi
if [[ -z "$public_ip" ]] && type -p drill >/dev/null; then
public_ip="$(drill myip.opendns.com @resolver1.opendns.com | \
awk '/^myip\./ && $3 == "IN" {print $5}')"
fi
if [[ -z "$public_ip" ]] && type -p curl >/dev/null; then if [[ -z "$public_ip" ]] && type -p curl >/dev/null; then
public_ip="$(curl --max-time "$public_ip_timeout" -w '\n' "$public_ip_host")" public_ip="$(curl --max-time "$public_ip_timeout" -w '\n' "$public_ip_host")"
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment