summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-06-29 11:18:34 +0100
committerJoe Carstairs <me@joeac.net>2026-06-29 11:18:34 +0100
commitd2716eda7582f3b6a39b44565f571bdb7d286394 (patch)
tree3bb3e172738bb4eb86e2e1be5926349306702726
parent7c1d05b5ed9c720133cfe1edebf685fbd073120e (diff)
uses dig myip.opendns.com instead of curl icanhazip.com for ipv4
-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