[+] Use cloudflare for public IP field (#416)

* Update neofetch

* [F] Fix drill cloudflare and add fallback

---------

Co-authored-by: Azalea <22280294+hykilpikonna@users.noreply.github.com>
This commit is contained in:
Ven0m0 2025-08-21 14:05:08 +02:00 committed by GitHub
parent 0c9e4db742
commit 455f0382e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5300,6 +5300,16 @@ get_local_ip() {
}
get_public_ip() {
if [[ -z "$public_ip_host" ]] && type -p dig >/dev/null; then
public_ip="$(dig +time=1 +tries=1 +short TXT ch whoami.cloudflare @1.1.1.1 | tr -d '"')"
[[ "$public_ip" =~ ^\; ]] && unset public_ip
fi
if [[ -z "$public_ip_host" ]] && [[ -z "$public_ip" ]] && type -p drill >/dev/null; then
public_ip="$(drill whoami.cloudflare TXT CH @1.1.1.1 | awk '/^whoami\./ && $3 == "CH" {print $5}' | tr -d '"')"
fi
# Fallback
if [[ -z "$public_ip_host" ]] && type -p dig >/dev/null; then
public_ip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com)"
[[ "$public_ip" =~ ^\; ]] && unset public_ip