1
0
mirror of https://github.com/EV21/dynb.git synced 2025-12-26 16:39:32 +01:00

feat: add DynDNS2 support for dynv6.com

This commit is contained in:
2021-01-24 22:53:18 +01:00
parent fa5086f197
commit e3781a87bb
3 changed files with 41 additions and 12 deletions

View File

@@ -5,6 +5,8 @@
### New ### New
* :sparkles: add DynDNS2 support for dynv6.com. [Eduard Veit]
* :sparkles: add .gitchangelog.rc. [Eduard Veit] * :sparkles: add .gitchangelog.rc. [Eduard Veit]
* :sparkles: add dynb. [Eduard Veit] * :sparkles: add dynb. [Eduard Veit]

View File

@@ -18,16 +18,18 @@ The following update methods are currently implemented:
### APIs ### APIs
* INWX JSON-RPC-API * INWX.com JSON-RPC-API
Limitations: Limitations:
- minimum TTL is 300 (5 minutes) - minimum TTL is 300 (5 minutes)
### DynDNS2 ### DynDNS2
* INWX DynDNS2 protocol * INWX.com
Limitations: Limitations:
- minimum TTL is 60 (1 minute) - minimum TTL is 60 (1 minute)
- one DynDNS account with one hostname is for free - one DynDNS account with one hostname is for free
* dynv6.com
- note: assign your token to the password setting
## 📦 Requirements ## 📦 Requirements

45
dynb.sh
View File

@@ -168,22 +168,43 @@ function updateRecord() {
# using DynDNS2 protocol # using DynDNS2 protocol
function dynupdate() { function dynupdate() {
myip_str=
myipv6_str=
INWX_DYNDNS_UPDATE_URL="https://dyndns.inwx.com/nic/update?" INWX_DYNDNS_UPDATE_URL="https://dyndns.inwx.com/nic/update?"
DYNV6_DYNDNS_UPDATE_URL="https://dynv6.com/api/update?zone=$_dyn_domain&token=$_password&"
if [[ $_serviceProvider == "inwx" ]]; then if [[ $_serviceProvider == "inwx" ]]; then
dyndns_update_url=$INWX_DYNDNS_UPDATE_URL dyndns_update_url=$INWX_DYNDNS_UPDATE_URL
myip_str=myip
myipv6_str=myipv6
fi fi
if [[ $_is_IPv4_enabled == true ]] && [[ $_is_IPv6_enabled == true ]]; then if [[ $_serviceProvider == "dynv6" ]]; then
dyndns_update_url="${dyndns_update_url}myip=${_new_IPv4}&myipv6=${_new_IPv6}" dyndns_update_url="${DYNV6_DYNDNS_UPDATE_URL}"
fi myip_str=ipv4
if [[ $_is_IPv4_enabled == true ]] && [[ $_is_IPv6_enabled == false ]]; then myipv6_str=ipv6
dyndns_update_url="${dyndns_update_url}myip=${_new_IPv4}"
fi
if [[ $_is_IPv4_enabled == false ]] && [[ $_is_IPv6_enabled == true ]]; then
dyndns_update_url="${dyndns_update_url}myipv6=${_new_IPv6}"
fi fi
result=$(curl --silent --user $_username:$_password "${dyndns_update_url}" ) if [[ $_is_IPv4_enabled == true ]] && [[ $_is_IPv6_enabled == true ]]; then
case $result in dyndns_update_url="${dyndns_update_url}${myip_str}=${_new_IPv4}&${myipv6_str}=${_new_IPv6}"
fi
if [[ $_is_IPv4_enabled == true ]] && [[ $_is_IPv6_enabled == false ]]; then
dyndns_update_url="${dyndns_update_url}${myip_str}=${_new_IPv4}"
fi
if [[ $_is_IPv4_enabled == false ]] && [[ $_is_IPv6_enabled == true ]]; then
dyndns_update_url="${dyndns_update_url}${myipv6_str}=${_new_IPv6}"
fi
## request ##
if [[ $_serviceProvider == "dynv6" ]]; then
response=$(curl --silent "${dyndns_update_url}" )
#echo $dyndns_update_url
fi
if [[ $_serviceProvider == "inwx" ]]; then
response=$(curl --silent --user "$_username":"$_password" "${dyndns_update_url}" )
fi
case $response in
good ) good )
echo "The DynDNS update has been executed." echo "The DynDNS update has been executed."
return return
@@ -220,6 +241,10 @@ function dynupdate() {
echo "There is an internal error in the dyndns update system" echo "There is an internal error in the dyndns update system"
return return
;; ;;
* )
echo "$response"
return
;;
esac esac
} }