diff --git a/Dockerfile b/Dockerfile index 85738f4..9b3ec61 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,8 @@ ARG DUCKDNS_VERSION LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="aptalca" +ENV UPDATE_IP=ipv4 + RUN \ echo "**** install packages ****" && \ apk add --no-cache \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index ef78e59..3622a28 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -9,6 +9,8 @@ ARG DUCKDNS_VERSION LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="aptalca" +ENV UPDATE_IP=ipv4 + RUN \ echo "**** install packages ****" && \ apk add --no-cache \ diff --git a/readme-vars.yml b/readme-vars.yml index 076b23b..fd82e21 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -39,7 +39,7 @@ cap_add_param_vars: "" # optional container parameters opt_param_usage_include_env: true opt_param_env_vars: - - { env_var: "FORCE_IPV6", env_value: "false", desc: "Set to `true` to update IP **only** with your public IPv6 address. NB: use only if you have a public IPv6 address."} + - { env_var: "UPDATE_IP", env_value: "ipv4", desc: "Set to `ipv6` to update **only** with your public IPv6 address. Set to `both` to update IPv6 and IPv4 address. Default to `ipv4`"} - { env_var: "LOG_FILE", env_value: "false", desc: "Set to `true` to log to file (also need to map /config)."} opt_param_usage_include_vols: true opt_param_volumes: diff --git a/root/app/duck.sh b/root/app/duck.sh index ca1350c..747c708 100755 --- a/root/app/duck.sh +++ b/root/app/duck.sh @@ -11,10 +11,14 @@ else fi { - if [ "${FORCE_IPV6}" = "true" ]; then + if [ "${UPDATE_IP}" = "both" ]; then + IPV4=$(curl -sS4 "https://ipconfig.io") + IPV6=$(curl -sS6 "https://ipconfig.io") + RESPONSE=$(curl -sS --max-time 60 "https://www.duckdns.org/update?domains=${SUBDOMAINS}&token=${TOKEN}&ip=${IPV4}&ipv6=${IPV6}") + elif [ "${UPDATE_IP}" = "ipv6" ]; then IPV6=$(curl -sS6 "https://ipconfig.io") RESPONSE=$(curl -sS --max-time 60 "https://www.duckdns.org/update?domains=${SUBDOMAINS}&token=${TOKEN}&ip=${IPV6}") - else + elif [ "${UPDATE_IP}" = "ipv4" ]; then RESPONSE=$(curl -sS --max-time 60 "https://www.duckdns.org/update?domains=${SUBDOMAINS}&token=${TOKEN}&ip=") fi