duckdns: add option to grab IP addresses from URLs (#1077)

* duckdns: add option to grab IP addresses from URLs

Enables use of external services instead of Duck DNS' automatic
detection, which at time of writing doesn't work with IPv6.

* Update config.json

* Update CHANGELOG.md

* Update README.md

Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>
This commit is contained in:
Ville Skyttä
2020-02-21 13:16:42 +02:00
committed by GitHub
parent dbc3c56b74
commit 5650ceaa16
4 changed files with 22 additions and 2 deletions

View File

@@ -1,5 +1,9 @@
# Changelog
## 1.12
- Add option to specify a service or URL as IPv4 and IPv6 address source
## 1.11
- Do not skip TLS security checks on Duck DNS API access

View File

@@ -67,12 +67,20 @@ By default, Duck DNS will auto detect your IPv4 address and use that.
This option allows you to override the auto-detection and specify an
IPv4 address manually.
If you specify a URL here, contents of the resource it points to will be
fetched and used as the address. This enables getting the address using
a service like https://api4.ipify.org/ or https://ipv4.wtfismyip.com/text
### Option: `ipv6` (optional)
By default, Duck DNS will auto detect your IPv6 address and use that.
This option allows you to override the auto-detection and specify an
IPv6 address manually.
If you specify a URL here, contents of the resource it points to will be
fetched and used as the address. This enables getting the address using
a service like https://api6.ipify.org/ or https://ipv6.wtfismyip.com/text
### Option: `token`
The DuckDNS authentication token found at the top of the DuckDNS account landing page. The token is required to make any changes to the subdomains registered to your account.
@@ -89,6 +97,9 @@ The number of seconds to wait before updating DuckDNS subdomains and renewing Le
- To log in, DuckDNS requires a free account from any of the following services: Google, Github, Twitter, Persona or Reddit.
- A free DuckDNS account is limited to five subdomains.
- At time of writing, Duck DNS' own IPv6 autodetection
[does not actually work][duckdns-faq], but you can use the URL option
for `ipv6` to get around this, read on.
## Support
@@ -112,3 +123,4 @@ In case you've found a bug, please [open an issue on our GitHub][issue].
[issue]: https://github.com/home-assistant/hassio-addons/issues
[reddit]: https://reddit.com/r/homeassistant
[duckdns]: https://duckdns.org
[duckdns-faq]: https://www.duckdns.org/faqs.jsp

View File

@@ -1,6 +1,6 @@
{
"name": "Duck DNS",
"version": "1.10",
"version": "1.11",
"slug": "duckdns",
"description": "Free Dynamic DNS (DynDNS or DDNS) service with Let's Encrypt support",
"url": "https://github.com/home-assistant/hassio-addons/tree/master/duckdns",

View File

@@ -50,7 +50,11 @@ fi
# Run duckdns
while true; do
if answer="$(curl -s "https://www.duckdns.org/update?domains=${DOMAINS}&token=${TOKEN}&ip=${IPV4}&ipv6=${IPV6}&verbose=true")"; then
[[ ${IPV4} != *:/* ]] && ipv4=${IPV4} || ipv4=$(curl -s -m 10 "${IPV4}")
[[ ${IPV6} != *:/* ]] && ipv6=${IPV6} || ipv6=$(curl -s -m 10 "${IPV6}")
if answer="$(curl -s "https://www.duckdns.org/update?domains=${DOMAINS}&token=${TOKEN}&ip=${ipv4}&ipv6=${ipv6}&verbose=true")"; then
bashio::log.info "${answer}"
else
bashio::log.warning "${answer}"