From c5a956e386ef8ca6163770ff712d75cf0e7a0b0b Mon Sep 17 00:00:00 2001 From: Jontron123 Date: Wed, 8 Feb 2023 07:59:52 -0500 Subject: [PATCH] Add support for Enom (#508) * Add support for Enom * Add support for Enom * Add support for Enom --- README.md | 1 + ddclient.conf.in | 8 +++++ ddclient.in | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) diff --git a/README.md b/README.md index d636b14..f5a6c5a 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Dynamic DNS services currently supported include: regfish.de - See https://www.regfish.de/domains/dyndns/ for details domenehsop - See https://api.domeneshop.no/docs/#tag/ddns/paths/~1dyndns~1update/get Mythic Beasts - See https://www.mythic-beasts.com/support/api/dnsv2/dynamic-dns for details + Enom - See https://www.enom.com for details `ddclient` now supports many cable and DSL broadband routers. diff --git a/ddclient.conf.in b/ddclient.conf.in index cd9df29..410b356 100644 --- a/ddclient.conf.in +++ b/ddclient.conf.in @@ -339,3 +339,11 @@ ssl=yes # use ssl-support. Works with # protocol=regfishde, # password=mypassword # my-domain.com + +## +## Enom (www.enom.com) +## +# protocol=enom, +# login=domain.name, +# password=domain-password +# my-domain.com diff --git a/ddclient.in b/ddclient.in index 8cbba46..530458f 100755 --- a/ddclient.in +++ b/ddclient.in @@ -957,6 +957,16 @@ my %services = ( $variables{'service-common-defaults'}, ), }, + 'enom' => { + 'updateable' => undef, + 'update' => \&nic_enom_update, + 'examples' => \&nic_enom_examples, + 'variables' => { + %{$variables{'service-common-defaults'}}, + 'server' => setv(T_FQDNP, 1, 0, 'dynamic.name-services.com', undef), + 'min-interval' => setv(T_DELAY, 0, 0, 0, interval('5m')), + }, + }, ); $variables{'merged'} = { map({ %{$services{$_}{'variables'}} } keys(%services)), @@ -7740,6 +7750,90 @@ sub nic_regfishde_update { } } +###################################################################### +###################################################################### +## enom +###################################################################### +sub nic_enom_examples { + return < opt('proxy'), + url => $url + ); + + if (!defined($reply) || !$reply) { + failed("updating %s: Could not connect to %s.", $h, $config{$h}{'server'}); + last; + } + + last if !header_ok($h, $reply); + + my @reply = split /\n/, $reply; + + if (grep /Done=true/i, @reply) { + $config{$h}{'ip'} = $ip; + $config{$h}{'mtime'} = $now; + $config{$h}{'status'} = 'good'; + success("updating %s: good: IP address set to %s", $h, $ip); + } else { + $config{$h}{'status'} = 'failed'; + warning("SENT: %s", $url) unless opt('verbose'); + warning("REPLIED: %s", $reply); + failed("updating %s: Invalid reply.", $h); + } + } +} + # Execute main() if this file is run as a script or run via PAR (https://metacpan.org/pod/PAR), # otherwise do nothing. This "modulino" pattern makes it possible to import this file as a module # and test its functions directly; there's no need for test-only command-line arguments or stdout