Added MyDNS.JP

Add support for MyDNS.JP
http://www.mydns.jp/
This commit is contained in:
epgdatacapbon 2016-01-11 16:01:05 +09:00
parent 02c983a991
commit 69f7fbbdc3
3 changed files with 100 additions and 25 deletions

View file

@ -1,5 +1,5 @@
=============================================================================== ===============================================================================
# DDCLIENT v3.9.0 # DDCLIENT v3.8.3
ddclient is a Perl client used to update dynamic DNS entries for accounts ddclient is a Perl client used to update dynamic DNS entries for accounts
on many dynamic DNS services. on many dynamic DNS services.
@ -26,8 +26,8 @@ Dynamic DNS services currently supported include:
CloudFlare - See https://www.cloudflare.com/ for details CloudFlare - See https://www.cloudflare.com/ for details
Google - See http://www.google.com/domains for details Google - See http://www.google.com/domains for details
Duckdns - See https://duckdns.org/ for details Duckdns - See https://duckdns.org/ for details
Freemyip - See https://freemyip.com for details
woima.fi - See https://woima.fi/ for details woima.fi - See https://woima.fi/ for details
MyDNS.JP - See http://www.mydns.jp/ for details
DDclient now supports many of cable/dsl broadband routers. DDclient now supports many of cable/dsl broadband routers.
@ -43,9 +43,8 @@ REQUIREMENTS:
- one or more accounts from one of the dynamic DNS services - one or more accounts from one of the dynamic DNS services
- Perl 5.014 or later - Perl 5.014 or later
(you need the IO::Socket::SSL perl library for ssl-support, (you need the IO::Socket::SSL perl library for ssl-support
JSON::PP perl library for JSON support and and JSON::Any perl library for JSON support)
IO::Socket:INET6 perl library for ipv6-support)
- Linux or probably any common Unix system - Linux or probably any common Unix system

View file

@ -483,6 +483,10 @@ my %variables = (
'warned-min-interval' => setv(T_ANY, 0, 1, 0, 0, undef), 'warned-min-interval' => setv(T_ANY, 0, 1, 0, 0, undef),
'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, 0, undef), 'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, 0, undef),
}, },
'mydns-common-defaults' => {
'server' => setv(T_FQDNP, 1, 0, 1, 'www.mydns.jp', undef),
'max-interval' => setv(T_DELAY, 0, 0, 1, interval('6d'), 0),
},
); );
my %services = ( my %services = (
'dyndns1' => { 'dyndns1' => {
@ -685,6 +689,15 @@ my %services = (
$variables{'woima-service-common-defaults'}, $variables{'woima-service-common-defaults'},
), ),
}, },
'mydns' => {
'updateable' => undef,
'update' => \&nic_mydns_update,
'examples' => \&nic_mydns_examples,
'variables' => merge(
$variables{'mydns-common-defaults'},
$variables{'service-common-defaults'},
),
},
); );
$variables{'merged'} = merge($variables{'global-defaults'}, $variables{'merged'} = merge($variables{'global-defaults'},
$variables{'service-common-defaults'}, $variables{'service-common-defaults'},
@ -4676,6 +4689,80 @@ sub nic_woima_update {
} }
} }
######################################################################
## nic_mydns_examples
######################################################################
sub nic_mydns_examples {
return <<EoEXAMPLE;
o 'mydns'
The 'mydns' protocol is used by a free dynamic DNS service offered by www.mydns.jp.
Configuration variables applicable to the 'mydns' protocol are:
protocol=mydns ##
server=fqdn.of.service ## defaults to www.mydns.jp
login=service-login ## login name and password registered with the service
password=service-password ##
fully.qualified.host ## the host registered with the service.
Example ${program}.conf file entries:
## single host update
protocol=mydns
login=my-mydns.jp-login
password=my-mydns.jp-password
myhost.mydns.jp
EoEXAMPLE
}
######################################################################
## nic_mydns_update
######################################################################
sub nic_mydns_update {
debug("\nnic_mydns_update -------------------");
## update each configured host
foreach my $h (@_) {
my $ip = delete $config{$h}{'wantip'};
info("setting IP address to %s for %s", $ip, $h);
verbose("UPDATE:","updating %s", $h);
# Set the URL that we're going to to update
my $url;
$url = "http://$config{$h}{'server'}/directip.html";
$url .= "?MID=";
$url .= $config{$h}{'login'};
$url .= "&PWD=";
$url .= $config{$h}{'password'};
$url .= "&IPV4ADDR=";
$url .= $ip;
# Try to get URL
my $reply = geturl(opt('proxy'), $url);
# No response, declare as failed
if (!defined($reply) || !$reply) {
failed("updating %s: Could not connect to %s.", $h, $config{$h}{'server'});
last;
}
last if !header_ok($h, $reply);
# Response found, check the reply
if ($reply =~ /login_status = 1/i)
{
$config{$h}{'ip'} = $ip;
$config{$h}{'mtime'} = $now;
$config{$h}{'status'} = 'good';
success("updating %s: good: IP address set to %s", $h, $ip);
}
else
{
$reply =~ /login_status.*\n.*\n(.+)\s*<BR>/i;
$config{$h}{'status'} = 'failed';
warning("SENT: %s", $url) unless opt('verbose');
warning("REPLIED: %s", $1);
failed("updating %s: Invalid reply.", $h);
}
}
}
###################################################################### ######################################################################
# vim: ai ts=4 sw=4 tw=78 : # vim: ai ts=4 sw=4 tw=78 :

View file

@ -200,9 +200,10 @@ ssl=yes # use ssl-support. Works with
## ##
#protocol=cloudflare, \ #protocol=cloudflare, \
#zone=domain.tld, \ #zone=domain.tld, \
#ttl=1, \ #server=www.cloudflare.com, \
#login=your-login-email, \ #login=your-login-email, \
#password=APIKey \ #password=APIKey, \
#ttl=1 \
#domain.tld,my.domain.tld #domain.tld,my.domain.tld
## ##
@ -221,22 +222,10 @@ ssl=yes # use ssl-support. Works with
# protocol=duckdns hostwithoutduckdnsorg # protocol=duckdns hostwithoutduckdnsorg
## ##
## Freemyip (http://freemyip.com/) ## MyDNS (www.mydns.jp)
## ##
# # protocol=mydns
# protocol=freemyip, # server=www.mydns.jp
# password=my-token # login=my-mydns.jp-login
# myhost # password=my-mydns.jp-password
# your-host.mydns.jp
##
## MyOnlinePortal (http://myonlineportal.net)
##
# protocol=dyndns2
# ssl=yes
# # ipv6=yes # optional
# use=web, web=myonlineportal.net/checkip
# # use=if, if=eth0 # alternative to use=web
# # if-skip=Scope:Link # alternative to use=web
# login=your-myonlineportal-username
# password=your-myonlineportal-password
# domain.myonlineportal.net