Remove public IP fetching function from run script

Removed the _fetch_public_ip function and its usage in the run script.
This commit is contained in:
Alexandre
2025-11-24 22:08:56 +01:00
committed by GitHub
parent 8aa7ce13ce
commit 49586fc243

View File

@@ -10,35 +10,6 @@ if bashio::config.true 'silent'; then
sed -i 's|/proc/1/fd/1 hassio;|off;|g' /etc/nginx/nginx.conf
fi
# --- Helper Functions ---
_fetch_public_ip() {
local resp
local url
local urls=(
"https://icanhazip.com"
"https://ifconfig.me/ip"
"https://api64.ipify.org"
"https://checkip.amazonaws.com"
"https://domains.google.com/checkip"
"https://ipinfo.io/ip"
)
local shuffled_urls
mapfile -t shuffled_urls < <(printf "%s\n" "${urls[@]}" | shuf)
# Loop through the now-randomized list
for url in "${shuffled_urls[@]}"; do
resp=$(curl -fsS --max-time 5 "${url}" 2>/dev/null || true)
resp="${resp//[[:space:]]/}"
# Validate IPv4 or IPv6
if [[ "${resp}" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]] || [[ "${resp}" =~ ^[0-9a-fA-F:]+$ ]]; then
printf '%s\n' "${resp}"
return 0
fi
done
return 1
}
# --- WireGuard Specific Logic ---
_setup_wireguard() {
@@ -165,8 +136,6 @@ if [[ "${openvpn_enabled}" == true && "${wireguard_enabled}" == true ]]; then
exit 1
fi
echo "$(_fetch_public_ip || true)" > /currentip
if [[ "${openvpn_enabled}" == true ]]; then
exec /usr/sbin/openvpn \