Adding support for google domain
Patch gently provided through github on https://github.com/wimpunk/ddclient/pull/13 git-svn-id: svn+ssh://svn.code.sf.net/p/ddclient/code/trunk@171 3873ddee-7413-0410-b6c4-c2c57c1ab35a
This commit is contained in:
parent
e384564d12
commit
c12ee9123c
3 changed files with 97 additions and 1 deletions
|
@ -23,7 +23,8 @@ Dynamic DNS services currently supported include:
|
|||
ChangeIP - See http://www.changeip.com/ for details
|
||||
dtdns - See http://www.dtdns.com/ for details
|
||||
nsupdate - See nsupdate(1) and ddns-confgen(8) for details
|
||||
CloudFlare - See https://www.cloudflare.com/ for defails
|
||||
CloudFlare - See https://www.cloudflare.com/ for details
|
||||
Google - See http://www.google.com/domains for details
|
||||
|
||||
DDclient now supports many of cable/dsl broadband routers.
|
||||
|
||||
|
|
87
ddclient
87
ddclient
|
@ -448,6 +448,9 @@ my %variables = (
|
|||
'mx' => setv(T_OFQDN, 0, 1, 1, '', undef),
|
||||
'backupmx' => setv(T_BOOL, 0, 1, 1, 0, undef),
|
||||
},
|
||||
'googledomains-common-defaults' => {
|
||||
'server' => setv(T_FQDNP, 1, 0, 1, 'domains.google.com', undef),
|
||||
},
|
||||
);
|
||||
my %services = (
|
||||
'dyndns1' => {
|
||||
|
@ -610,6 +613,14 @@ my %services = (
|
|||
{ 'server' => setv(T_FQDNP, 1, 0, 1, 'www.cloudflare.com', undef) },
|
||||
{ 'min-interval' => setv(T_DELAY, 0, 0, 1, interval('5m'), 0),},
|
||||
$variables{'cloudflare-common-defaults'},
|
||||
},
|
||||
'googledomains' => {
|
||||
'updateable' => undef,
|
||||
'update' => \&nic_googledomains_update,
|
||||
'examples' => \&nic_googledomains_examples,
|
||||
'variables' => merge(
|
||||
{ 'min-interval' => setv(T_DELAY, 0, 0, 1, interval('5m'), 0),},
|
||||
$variables{'googledomains-common-defaults'},
|
||||
$variables{'service-common-defaults'},
|
||||
),
|
||||
},
|
||||
|
@ -3803,6 +3814,82 @@ sub nic_dtdns_update {
|
|||
}
|
||||
}
|
||||
}
|
||||
######################################################################
|
||||
|
||||
######################################################################
|
||||
## nic_googledomains_examples
|
||||
##
|
||||
## written by Nelson Araujo
|
||||
##
|
||||
######################################################################
|
||||
sub nic_googledomains_examples {
|
||||
return <<EoEXAMPLE;
|
||||
o 'googledomains'
|
||||
|
||||
The 'googledomains' protocol is used by DNS service offered by www.google.com/domains.
|
||||
|
||||
Configuration variables applicable to the 'googledomains' protocol are:
|
||||
protocol=googledomains ##
|
||||
login=service-login ## the user name provided by the admin interface
|
||||
password=service-password ## the password provided by the admin interface
|
||||
fully.qualified.host ## the host registered with the service.
|
||||
|
||||
Example ${program}.conf file entries:
|
||||
## single host update
|
||||
protocol=googledomains, \\
|
||||
login=my-generated-user-name, \\
|
||||
password=my-genereated-password \\
|
||||
myhost.com
|
||||
|
||||
## multiple host update to the custom DNS service
|
||||
protocol=googledomains, \\
|
||||
login=my-generated-user-name, \\
|
||||
password=my-genereated-password \\
|
||||
my-toplevel-domain.com,my-other-domain.com
|
||||
EoEXAMPLE
|
||||
}
|
||||
######################################################################
|
||||
## nic_googledomains_update
|
||||
######################################################################
|
||||
sub nic_googledomains_update {
|
||||
debug("\nnic_googledomains_update -------------------");
|
||||
|
||||
## group hosts with identical attributes together
|
||||
my %groups = group_hosts_by([ @_ ], [ qw(server login password) ]);
|
||||
|
||||
## update each set of hosts that had similar configurations
|
||||
foreach my $sig (keys %groups) {
|
||||
my @hosts = @{$groups{$sig}};
|
||||
my $key = $hosts[0];
|
||||
my $ip = $config{$key}{'wantip'};
|
||||
|
||||
# FQDNs
|
||||
for my $host (@hosts) {
|
||||
delete $config{$host}{'wantip'};
|
||||
|
||||
info("setting IP address to %s for %s", $ip, $host);
|
||||
verbose("UPDATE:","updating %s", $host);
|
||||
|
||||
# Update the DNS record
|
||||
my $url = "https://$config{$host}{'server'}/nic/update";
|
||||
$url .= "?hostname=$host";
|
||||
$url .= "&myip=";
|
||||
$url .= $ip if $ip;
|
||||
|
||||
my $reply = geturl(opt('proxy'), $url, $config{$host}{'login'}, $config{$host}{'password'});
|
||||
unless ($reply) {
|
||||
failed("updating %s: Could not connect to %s.", $host, $config{$host}{'server'});
|
||||
last;
|
||||
}
|
||||
last if !header_ok($host, $reply);
|
||||
|
||||
# Cache
|
||||
$config{$host}{'ip'} = $ip;
|
||||
$config{$host}{'mtime'} = $now;
|
||||
$config{$host}{'status'} = 'good';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
## nic_nsupdate_examples
|
||||
|
|
|
@ -206,3 +206,11 @@ ssl=yes # use ssl-support. Works with
|
|||
#login=your-login-email, \
|
||||
#password=APIKey \
|
||||
#domain.tld,my.domain.tld
|
||||
|
||||
##
|
||||
## Google Domains (www.google.com/domains)
|
||||
##
|
||||
# protocol=googledomains,
|
||||
# login=my-auto-generated-username,
|
||||
# password=my-auto-generated-password
|
||||
# my.domain.tld, otherhost.domain.tld
|
||||
|
|
Loading…
Reference in a new issue