mirror of
https://github.com/RogerSik/godaddy_ddns.git
synced 2024-11-23 17:10:27 +01:00
ipv6 script is now working
This commit is contained in:
parent
4f24fad154
commit
589f67b8c1
@ -13,7 +13,7 @@
|
||||
#Update the first 4 variables with your information
|
||||
|
||||
domain="" # your domain
|
||||
name="" # name of A record to update
|
||||
name="" # name of AAAA record to update
|
||||
key="" # key for godaddy developer API
|
||||
secret="" # secret for godaddy developer API
|
||||
|
||||
@ -24,19 +24,19 @@ headers="Authorization: sso-key $key:$secret"
|
||||
result=$(curl -s -X GET -H "$headers" \
|
||||
"https://api.godaddy.com/v1/domains/$domain/records/AAAA/$name")
|
||||
|
||||
dnsIp=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
|
||||
dnsIp=$(echo $result | grep -Eo "2[0-9a-fA-F]{3}:(([0-9a-fA-F]{1,4}[:]{1,2}){1,6}[0-9a-fA-F]{1,4})")
|
||||
echo "dnsIp:" $dnsIp
|
||||
|
||||
# Get public ip address there are several websites that can do this.
|
||||
currentIp=$(curl -s GET "https://ipv6.wtfismyip.com/text")
|
||||
echo "currentIp:" $currentIp
|
||||
|
||||
if [ $dnsIp != $currentIp ];
|
||||
if [ $dnsIp != $currentIp ];
|
||||
then
|
||||
# echo "Ips are not equal" # debig
|
||||
request='{"data":"'$currentIp'","ttl":600}'
|
||||
# echo "Ips are not equal" # debug
|
||||
request='[{"data":"'$currentIp'","name":"'$name'","ttl":600,"type":"AAAA"}]'
|
||||
# echo $request # debug
|
||||
nresult=$(curl -i -s -X PUT \
|
||||
result=$(curl -i -s -X PUT \
|
||||
-H "$headers" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d $request "https://api.godaddy.com/v1/domains/$domain/records/AAAA/$name")
|
||||
|
Loading…
Reference in New Issue
Block a user