Update ddclient.in
This commit is contained in:
parent
29648af7d1
commit
95fd3c1bc3
1 changed files with 72 additions and 0 deletions
72
ddclient.in
72
ddclient.in
|
|
@ -533,6 +533,10 @@ my %variables = (
|
|||
'script' => setv(T_STRING, 0, 1, '/RemoteUpdate.sv', undef),
|
||||
'min-error-interval' => setv(T_DELAY, 0, 0, interval('8m'), 0),
|
||||
},
|
||||
'regfishde-common-defaults' => {
|
||||
'server' => setv(T_FQDNP, 1, 0, 'dyndns.regfish.de', undef),
|
||||
'login' => setv(T_LOGIN, 0, 0, 0, 'unused', undef),
|
||||
},
|
||||
);
|
||||
my %services = (
|
||||
'1984' => {
|
||||
|
|
@ -895,6 +899,15 @@ my %services = (
|
|||
$variables{'service-common-defaults'},
|
||||
),
|
||||
},
|
||||
'regfishde' => {
|
||||
'updateable' => undef,
|
||||
'update' => \&nic_regfishdev4_update,
|
||||
'examples' => \&nic_regfishdev4_examples,
|
||||
'variables' => merge(
|
||||
$variables{'regfishde-common-defaults'},
|
||||
$variables{'service-common-defaults'},
|
||||
),
|
||||
},
|
||||
);
|
||||
$variables{'merged'} = {
|
||||
map({ %{$services{$_}{'variables'}} } keys(%services)),
|
||||
|
|
@ -7162,6 +7175,65 @@ sub nic_keysystems_update {
|
|||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## nic_regfishdev4_examples
|
||||
######################################################################
|
||||
sub nic_regfishdev4_examples {
|
||||
return <<EoEXAMPLE;
|
||||
o 'regfishde'
|
||||
The 'regfishde' protocol is used by the non-free dynamic DNS service offered by www.regfish.de.
|
||||
Check https://www.regfish.de for configuration variables applicable to the 'regfishde' protocol:
|
||||
protocol=regfishde
|
||||
server=dyndns.regfish.de
|
||||
password=service-password ## password (token) registered with the service
|
||||
myhost.mydomain.com ## the host registered with the service.
|
||||
Example ${program}.conf file entries:
|
||||
## single host update
|
||||
protocol=regfishde, \
|
||||
password=service-password \
|
||||
myhost.mydomain.com
|
||||
EoEXAMPLE
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## nic_regfishdev4_update
|
||||
## response contains "success" on succesfull completion
|
||||
######################################################################
|
||||
sub nic_regfishdev4_update {
|
||||
debug("\nnic_regfishdev4_update -------------------");
|
||||
|
||||
## update each configured host
|
||||
## should improve to update in one pass
|
||||
for my $h (@_) {
|
||||
my $ip = delete $config{$h}{'wantip'};
|
||||
info("regfish.de setting IP address to %s for %s", $ip, $h);
|
||||
|
||||
my $url = "https://$config{$h}{'server'}/?fqdn=$h&ipv4=$ip&forcehost=1&token=$config{$h}{'password'}";
|
||||
|
||||
# Try to get URL
|
||||
my $reply = geturl(proxy => opt('proxy'), url => $url);
|
||||
|
||||
# No response, declare as failed
|
||||
if (!defined($reply) || !$reply) {
|
||||
failed("regfish.de updating %s: Could not connect to %s.", $h, $config{$h}{'server'});
|
||||
last;
|
||||
}
|
||||
last if !header_ok($h, $reply);
|
||||
|
||||
if ($reply =~ /success/)
|
||||
{
|
||||
$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';
|
||||
failed("updating %s: Server said: '$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
|
||||
|
|
|
|||
Loading…
Reference in a new issue