Pull request #560: Updated GoDaddy to new IPv4/IPv6 logic
Changes by Lenard Hess based on Awalon's pull request: - Rebased to master - Removed use=disabled addition from this commit
This commit is contained in:
parent
fc4f87b33e
commit
f5a1a906d1
2 changed files with 86 additions and 70 deletions
|
@ -203,6 +203,16 @@ ssl=yes # use ssl-support. Works with
|
||||||
# ttl=10800 # optional
|
# ttl=10800 # optional
|
||||||
# myhost.example.com
|
# myhost.example.com
|
||||||
|
|
||||||
|
##
|
||||||
|
## GoDaddy (godaddy.com)
|
||||||
|
##
|
||||||
|
# protocol=godaddy, \
|
||||||
|
# password=my-godaddy-api-key, \
|
||||||
|
# password=my-godaddy-secret, \
|
||||||
|
# ttl=600 \
|
||||||
|
# zone=example.com, \
|
||||||
|
# myhost.example.com,nexthost.example.com
|
||||||
|
|
||||||
##
|
##
|
||||||
## Google Domains (www.google.com/domains)
|
## Google Domains (www.google.com/domains)
|
||||||
##
|
##
|
||||||
|
|
18
ddclient.in
18
ddclient.in
|
@ -5698,15 +5698,20 @@ sub nic_godaddy_update {
|
||||||
|
|
||||||
# Update each set configured host.
|
# Update each set configured host.
|
||||||
for my $host (@hosts) {
|
for my $host (@hosts) {
|
||||||
my $ip = delete $config{$host}{'wantip'};
|
my $ipv4 = delete $config{$host}{'wantipv4'};
|
||||||
|
my $ipv6 = delete $config{$host}{'wantipv6'};
|
||||||
|
|
||||||
my $zone = $config{$host}{'zone'};
|
my $zone = $config{$host}{'zone'};
|
||||||
(my $hostname = $host) =~ s/\.\Q$zone\E$//;
|
(my $hostname = $host) =~ s/\.\Q$zone\E$//;
|
||||||
|
|
||||||
|
foreach my $ip ($ipv4, $ipv6) {
|
||||||
|
next if (!$ip);
|
||||||
|
|
||||||
info("%s.%s -- Setting IP address to %s.", $hostname, $zone, $ip);
|
info("%s.%s -- Setting IP address to %s.", $hostname, $zone, $ip);
|
||||||
verbose("UPDATE:", "updating %s.%s", $hostname, $zone);
|
verbose("UPDATE:", "updating %s.%s", $hostname, $zone);
|
||||||
|
|
||||||
my $ipversion = is_ipv6($ip) ? "6" : "4";
|
my $ipversion = ($ip eq ($ipv6 // '')) ? '6' : '4';
|
||||||
my $rrset_type = $ipversion == "6" ? "AAAA" : "A";
|
my $rrset_type = ($ipversion eq '6') ? 'AAAA' : 'A';
|
||||||
my $data = encode_json([ {
|
my $data = encode_json([ {
|
||||||
data => $ip,
|
data => $ip,
|
||||||
defined($config{$host}{'ttl'}) ? (ttl => $config{$host}{'ttl'}) : (),
|
defined($config{$host}{'ttl'}) ? (ttl => $config{$host}{'ttl'}) : (),
|
||||||
|
@ -5746,9 +5751,9 @@ sub nic_godaddy_update {
|
||||||
}
|
}
|
||||||
if ($ok) {
|
if ($ok) {
|
||||||
# read data
|
# read data
|
||||||
$config{$host}{'ip'} = $ip;
|
$config{$host}{"ipv$ipversion"} = $ip;
|
||||||
$config{$host}{'mtime'} = $now;
|
$config{$host}{'mtime'} = $now;
|
||||||
$config{$host}{'status'} = "good";
|
$config{$host}{"status-ipv$ipversion"} = 'good';
|
||||||
|
|
||||||
success("%s.%s -- Updated successfully to %s (status: %s).", $hostname, $zone, $ip, $status);
|
success("%s.%s -- Updated successfully to %s (status: %s).", $hostname, $zone, $ip, $status);
|
||||||
next;
|
next;
|
||||||
|
@ -5775,11 +5780,12 @@ sub nic_godaddy_update {
|
||||||
$msg = 'Unexpected service response.';
|
$msg = 'Unexpected service response.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$config{$host}{'status'} = "bad";
|
$config{$host}{"status-ipv$ipversion"} = 'bad';
|
||||||
failed("%s.%s -- %s", $hostname, $zone, $msg);
|
failed("%s.%s -- %s", $hostname, $zone, $msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
## nic_googledomains_examples
|
## nic_googledomains_examples
|
||||||
|
|
Loading…
Reference in a new issue