1
0

make work

This commit is contained in:
dtb 2022-10-22 01:24:18 -04:00
parent 84e9d5ab22
commit 9c73c85848

View File

@ -1,16 +1,24 @@
#!/bin/sh #!/bin/sh
PUBLIC_IP4="$(curl -4 --connect-timeout 5 "$PUBLIC_IP_FETCH_URL" --no-progress-meter 2>/dev/null \ : HTTP APIs that return your public IP address [both v4 and v6] "\
|| printf "-1")" https://icanhazip.com
PUBLIC_IP6="$(curl -6 --connect-timeout 5 "$PUBLIC_IP6_FETCH_URL" --no-progress-meter 2>/dev/null \ https://ifconfig.io
|| printf "-1")" http://icanhazip.com
if [ "$PUBLIC_IP4" = "-1" ] && [ "$PUBLIC_IP6" = "-1" ]; then http://ifconfig.io/
printf "[error fetching address]" "
elif [ "$PUBLIC_IP4" = "-1" ]; then
printf "%b" "$PUBLIC_IP6" PUBLIC_IP_FETCH_URL="https://icanhazip.com"
elif [ "$PUBLIC_IP6" = "-1" ]; then PUBLIC_IP6_FETCH_URL="$PUBLIC_IP_FETCH_URL"
printf "%b" "$PUBLIC_IP4"
else pscat \
printf "%b / %b" "$PUBLIC_IP4" "$PUBLIC_IP6" [ curl -4 --connect-timeout 5 --silent "$PUBLIC_IP_FETCH_URL" \
fi ] \
[ printf ' / ' ] \
[ curl -6 --connect-timeout 5 --silent \
"$PUBLIC_IP6_FETCH_URL" ] \
| tr -d '\n' \
| xargs echo \
| sed 's/ \/$//g' \
| sed 's/^\/ //g'
exit 0 exit 0