From cc7bcfd1863bc569b78fde824365caad04e2ddbb Mon Sep 17 00:00:00 2001 From: cindrmon Date: Fri, 27 Aug 2021 11:19:22 +0800 Subject: [PATCH] add the ability to select public ip picker apis into one array --- cloudflare-template.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cloudflare-template.sh b/cloudflare-template.sh index 3fbca66..70ab561 100644 --- a/cloudflare-template.sh +++ b/cloudflare-template.sh @@ -13,9 +13,17 @@ proxy=false # Set the proxy to true or fa ########################################### ## Check if we have a public IP ########################################### -ip=$(curl -s https://api.ipify.org || curl -s https://ipv4.icanhazip.com/) -if [ "${ip}" == "" ]; then +## Public IP Sources/APIs +public_ip_sources=( + "https://api.ipify.org/" + "https://ipv4.icanhazip.com/" + "https://dynamicdns.park-your-domain.com/getip" +) + +ip=$(curl -s ${public_ip_sources[@]}) + +if [[ $ip == "" ]]; then logger -s "DDNS Updater: No public IP found" exit 1 fi