Add DDNS.FM support

This commit is contained in:
woolflare 2024-07-06 04:19:23 +08:00 committed by Richard Hansen
parent af0035d266
commit 2f4b0859bd
4 changed files with 77 additions and 0 deletions

View file

@ -68,6 +68,8 @@ repository history](https://github.com/ddclient/ddclient/commits/master).
option can now include `http://` or `https://` to control the use of TLS.
If omitted, the value of the `ssl` option is used to determine the scheme.
[#703](https://github.com/ddclient/ddclient/pull/703)
* `ddns.fm`: New `protocol` option for updating [DDNS.FM](https://ddns.fm/)
records. [#695](https://github.com/ddclient/ddclient/pull/695)
### Bug fixes

View file

@ -17,6 +17,7 @@ Dynamic DNS services currently supported include:
* [ChangeIP](https://www.changeip.com)
* [CloudFlare](https://www.cloudflare.com)
* [ClouDNS](https://www.cloudns.net)
* [DDNS.fm](https://www.ddns.fm/)
* [DigitalOcean](https://www.digitalocean.com/)
* [dinahosting](https://dinahosting.com)
* [DonDominio](https://www.dondominio.com)

View file

@ -248,6 +248,14 @@ pid=@runstatedir@/ddclient.pid # record PID in file.
# password=my-token
# myhost
##
## DDNS.FM (https://ddns.fm/)
##
#
# protocol=ddns.fm,
# password=my-token
# myhost.example.com
##
## MyOnlinePortal (http://myonlineportal.net)
##

View file

@ -762,6 +762,16 @@ our %protocols = (
'dynurl' => setv(T_STRING, 1, 0, undef, undef),
},
},
'ddns.fm' => {
'force_update' => undef,
'update' => \&nic_ddnsfm_update,
'examples' => \&nic_ddnsfm_examples,
'variables' => {
%{$variables{'protocol-common-defaults'}},
'login' => undef,
'server' => setv(T_FQDNP, 0, 0, 'https://api.ddns.fm', undef),
},
},
'digitalocean' => {
'force_update' => undef,
'update' => \&nic_digitalocean_update,
@ -6730,6 +6740,62 @@ sub nic_freemyip_update {
}
}
######################################################################
## nic_ddnsfm_examples
######################################################################
sub nic_ddnsfm_examples {
return <<"EoEXAMPLE";
o 'ddns.fm'
The 'ddns.fm' protocol is used by the free
dynamic DNS service available at ddns.fm.
API is documented here: https://ddns.fm/docs
Configuration variables applicable to the 'ddns.fm' protocol are:
protocol=ddns.fm ##
password=service-key ## key for your domain
non-fully.qualified.host ## the host registered with the service.
Example ${program}.conf file entries:
## single host update
protocol=ddns.fm, \\
password=your_ddns_key, \\
myhost.example.com
EoEXAMPLE
}
######################################################################
## nic_ddnsfm_update
######################################################################
sub nic_ddnsfm_update {
debug("\nnic_ddnsfm_update -------------------");
for my $h (@_) {
# ddns.fm behavior as of 2024-07-14:
# - IPv4 and IPv6 addresses cannot be updated simultaneously.
# - IPv4 updates do not affect the IPv6 AAAA record (if present).
# - IPv6 updates do not affect the IPv4 A record (if present).
for my $ipv ('4', '6') {
my $ip = delete $config{$h}{"wantipv$ipv"} or next;
info("setting IPv$ipv address to $ip for $h");
verbose("UPDATE:", "updating %s", $h);
my $reply = geturl(
proxy => opt('proxy'),
url => "$config{$h}{server}/update?key=$config{$h}{password}&domain=$h&myip=$ip",
);
if (!$reply) {
failed("updating %s: Could not connect to %s.", $h, $config{$h}{'server'});
next;
}
next if !header_ok($h, $reply);
$config{$h}{"ipv$ipv"} = $ip;
$config{$h}{'mtime'} = $now;
$config{$h}{"status-ipv$ipv"} = 'good';
success("updating $h: good: IPv$ipv address set to $ip");
}
}
}
######################################################################
## nic_woima_examples
######################################################################