diff options
| author | Joe Carstairs <me@joeac.net> | 2026-06-29 11:18:34 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2026-06-29 11:18:34 +0100 |
| commit | d2716eda7582f3b6a39b44565f571bdb7d286394 (patch) | |
| tree | 3bb3e172738bb4eb86e2e1be5926349306702726 | |
| parent | 7c1d05b5ed9c720133cfe1edebf685fbd073120e (diff) | |
uses dig myip.opendns.com instead of curl icanhazip.com for ipv4
| -rwxr-xr-x | get_ip_addr.sh | 5 |
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 |
