This commit is contained in:
Brian Shea 2025-01-09 23:24:17 -05:00 committed by GitHub
commit 4d628de85d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 77 additions and 0 deletions

View file

@ -16,6 +16,11 @@ repository history](https://github.com/ddclient/ddclient/commits/main).
special characters are preserved literally. special characters are preserved literally.
[#766](https://github.com/ddclient/ddclient/pull/766) [#766](https://github.com/ddclient/ddclient/pull/766)
### New features
* `myaddr`: New `protocol` option for updating [myaddr](https://myaddr.tools/)
records. [#785](https://github.com/ddclient/ddclient/pull/785)
## 2025-01-07 v4.0.0-rc.2 ## 2025-01-07 v4.0.0-rc.2
### Breaking changes ### Breaking changes

View file

@ -39,6 +39,7 @@ Dynamic DNS services currently supported include:
* [Infomaniak](https://faq.infomaniak.com/2376) * [Infomaniak](https://faq.infomaniak.com/2376)
* [INWX](https://www.inwx.com/) * [INWX](https://www.inwx.com/)
* [Loopia](https://www.loopia.se) * [Loopia](https://www.loopia.se)
* [Myaddr](https://myaddr.tools)
* [Mythic Beasts](https://www.mythic-beasts.com/support/api/dnsv2/dynamic-dns) * [Mythic Beasts](https://www.mythic-beasts.com/support/api/dnsv2/dynamic-dns)
* [NameCheap](https://www.namecheap.com) * [NameCheap](https://www.namecheap.com)
* [NearlyFreeSpeech.net](https://www.nearlyfreespeech.net/services/dns) * [NearlyFreeSpeech.net](https://www.nearlyfreespeech.net/services/dns)

View file

@ -231,6 +231,13 @@ pid=@runstatedir@/ddclient.pid # record PID in file.
# password=my-token # password=my-token
# myhost.example.com # myhost.example.com
##
## Myaddr (myaddr.tools)
##
# protocol=myaddr
# password=private-key
# myname.myaddr.tools
## ##
## MyOnlinePortal (http://myonlineportal.net) ## MyOnlinePortal (http://myonlineportal.net)
## ##

View file

@ -1143,6 +1143,15 @@ our %protocols = (
'script' => setv(T_STRING, 0, '/nic/update', undef), 'script' => setv(T_STRING, 0, '/nic/update', undef),
}, },
), ),
'myaddr' => ddclient::Protocol->new(
'update' => \&nic_myaddr_update,
'examples' => \&nic_myaddr_examples,
'cfgvars' => {
%{$cfgvars{'protocol-common-defaults'}},
'login' => undef,
'server' => setv(T_FQDNP, 0, 'myaddr.tools', undef),
},
),
'mythicdyn' => ddclient::Protocol->new( 'mythicdyn' => ddclient::Protocol->new(
'update' => \&nic_mythicdyn_update, 'update' => \&nic_mythicdyn_update,
'examples' => \&nic_mythicdyn_examples, 'examples' => \&nic_mythicdyn_examples,
@ -5626,6 +5635,61 @@ sub nic_henet_update {
} }
} }
######################################################################
## nic_myaddr_examples
######################################################################
sub nic_myaddr_examples {
my $self = shift;
return <<"EoEXAMPLE";
o 'myaddr'
The 'myaddr' protocol is used by the DNS service offered by myaddr.tools.
Configuration variables applicable to the 'myaddr' protocol are:
protocol=myaddr
password=private-key ## the private key corresponding to the domain to
## update
myname.myaddr.tools ## a name (not used by the service; the above key
## uniquely identifies the domain to update)
Example ${program}.conf file entries:
protocol=myaddr, \\
password=6bcf18a592bbc85bcee439e1e42def483ff3ef632a84df7ece5ff072f72887c1, \\
example.myaddr.tools
EoEXAMPLE
}
######################################################################
## nic_myaddr_update
######################################################################
sub nic_myaddr_update {
my $self = shift;
for my $group (group_hosts_by(\@_, qw(password server wantipv4 wantipv6))) {
local $_l = pushlogctx(join(',', @{$group->{hosts}}));
my $key = $group->{cfg}{password};
my $server = $group->{cfg}{server};
for my $v (4, 6) {
delete $config{$_}{"wantipv$v"} for @{$group->{hosts}};
my $ip = $group->{cfg}{"wantipv$v"};
next if !$ip;
info("setting IPv$v address to $ip");
my $reply = geturl(
proxy => opt('proxy'),
url => "https://$server/update?key=$key&ip=$ip",
);
next if !header_ok($reply);
# a 200 response indicates success
for my $h (@{$group->{hosts}}) {
$recap{$h}{mtime} = $now;
$recap{$h}{"ipv$v"} = $ip;
$recap{$h}{"status-ipv$v"} = 'good';
}
success("IPv$v address set to $ip");
}
}
}
###################################################################### ######################################################################
## nic_mythicdyn_examples ## nic_mythicdyn_examples
## ##