summaryrefslogtreecommitdiff
path: root/get_ip_addr.sh
diff options
context:
space:
mode:
Diffstat (limited to 'get_ip_addr.sh')
-rwxr-xr-xget_ip_addr.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/get_ip_addr.sh b/get_ip_addr.sh
index 057fcd0..f7f8ea2 100755
--- a/get_ip_addr.sh
+++ b/get_ip_addr.sh
@@ -7,8 +7,9 @@ if [ -z "${ip_version:-}" ] || ([ "$ip_version" != 4 ] && [ "$ip_version" != 6 ]
fi
if [ $ip_version = 4 ]; then
- curl -4 http://icanhazip.com 2> /dev/null
- exit 0
+ dig +short myip.opendns.com @resolver1.opendns.com \
+ && exit 0 \
+ || exit 1
fi
set -eu