From 36ab69bd59714357c9ec8dfebcbd2c91858bdc42 Mon Sep 17 00:00:00 2001 From: Vigilans Date: Sun, 21 Aug 2022 13:31:36 +0800 Subject: [PATCH] Allow url for querying public ipv6 address to be configurable --- ardnspod | 10 ++++++++-- ddnspod.sh | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ardnspod b/ardnspod index c8a44fa..6804ea6 100644 --- a/ardnspod +++ b/ardnspod @@ -24,6 +24,12 @@ if ! type arLog >/dev/null 2>&1; then } fi +# The url to be used for querying public ipv6 address. We set a default here. + +if [ -z "$arIp6QueryUrl" ]; then + arIp6QueryUrl="https://6.ipw.cn" +fi + # The error code to return when a ddns record is not changed if [ -z "$arErrCodeUnchanged" ]; then @@ -83,9 +89,9 @@ arWanIp6() { if [ -z "$hostIp" ]; then if type curl >/dev/null 2>&1; then - hostIp=$(curl -s 6.ipw.cn) + hostIp=$(curl -6 -s $arIp6QueryUrl) else - hostIp=$(wget -q -O- 6.ipw.cn) + hostIp=$(wget -6 -q -O- $arIp6QueryUrl) fi fi diff --git a/ddnspod.sh b/ddnspod.sh index b71c066..3311d69 100755 --- a/ddnspod.sh +++ b/ddnspod.sh @@ -7,6 +7,10 @@ # Combine your token ID and token together as follows arToken="12345,7676f344eaeaea9074c123451234512d" +# Web endpoint to be used for querying the public IPv6 address +# Set this to override the default url provided by ardnspod +# arIp6QueryUrl="https://6.ipw.cn" + # Return code when the last record IP is same as current host IP # Set this to a value other than 0 to distinguish with a successful ddns update # arErrCodeUnchanged=0