Commit c1b48696 authored by alasley's avatar alasley Committed by Franco Fichtner

Dynamic DNS: Support Google Domains (#1411)

* added dynamic DNS support for Google Domains

* use tabs to be consistent

* add missing error message, last-tested date

(cherry picked from commit 9b23eeef)
parent e15c7428
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
* - GratisDNS (gratisdns.dk) * - GratisDNS (gratisdns.dk)
* - City Network (citynetwork.se) * - City Network (citynetwork.se)
* - Duck DNS (duckdns.org) * - Duck DNS (duckdns.org)
* - Google Domains (domains.google.com)
* +----------------------------------------------------+ * +----------------------------------------------------+
* Requirements: * Requirements:
* - PHP version 4.0.2 or higher with the CURL Library and the PCRE Library * - PHP version 4.0.2 or higher with the CURL Library and the PCRE Library
...@@ -75,6 +76,7 @@ ...@@ -75,6 +76,7 @@
* OVH DynHOST - Last Tested: NEVER * OVH DynHOST - Last Tested: NEVER
* City Network - Last Tested: 13 November 2013 * City Network - Last Tested: 13 November 2013
* Duck DNS - Last Tested: 04 March 2015 * Duck DNS - Last Tested: 04 March 2015
* Google Domains - Last Tested: 20 February 2017
* +====================================================+ * +====================================================+
* *
* @author E.Kristensen * @author E.Kristensen
...@@ -248,6 +250,7 @@ ...@@ -248,6 +250,7 @@
case 'eurodns': case 'eurodns':
case 'gratisdns': case 'gratisdns':
case 'ovh-dynhost': case 'ovh-dynhost':
case 'googledomains':
case 'citynetwork': case 'citynetwork':
case 'duckdns': case 'duckdns':
$this->_update(); $this->_update();
...@@ -702,6 +705,19 @@ ...@@ -702,6 +705,19 @@
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_URL, $server . '?domains=' . str_replace('.duckdns.org', '', $this->_dnsHost) . '&token=' . $this->_dnsUser); curl_setopt($ch, CURLOPT_URL, $server . '?domains=' . str_replace('.duckdns.org', '', $this->_dnsHost) . '&token=' . $this->_dnsUser);
break; break;
case 'googledomains':
if ($this->_dnsVerboseLog)
log_error("Google Domains: ({$this->_dnsHost}): DNS update() starting.");
$server = "https://domains.google.com/nic/update";
$post_data['hostname'] = $this->_dnsHost;
$post_data['myip'] = $this->_dnsIP;
$post_data['offline'] = 'no';
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_URL, $server);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
break;
default: default:
break; break;
} }
...@@ -1208,6 +1224,30 @@ ...@@ -1208,6 +1224,30 @@
$this->_debug($data); $this->_debug($data);
} }
break; break;
case 'googledomains':
if (preg_match('/notfqdn/i', $data)) {
$status = "Dynamic DNS: (Error) Not a FQDN";
} else if (preg_match('/nochg/i', $data)) {
$status = "Dynamic DNS: (Success) No change in IP address";
$successful_update = true;
} else if (preg_match('/good/i', $data)) {
$status = "Dynamic DNS: (Success) IP address updated successfully";
$successful_update = true;
} else if (preg_match('/badauth/i', $data)) {
$status = "Dynamic DNS: (Error) Authentication failed";
} else if (preg_match('/nohost/i', $data)) {
$status = "Dynamic DNS: (Error) Hostname does not exist or does not have dynamic DNS enabled";
} else if (preg_match('/badagent/i', $data)) {
$status = "Dynamic DNS: (Error) Bad request";
} else if (preg_match('/abuse/i', $data)) {
$status = "Dynamic DNS: (Error) Access has been blocked for abuse";
} else if (preg_match('/911/i', $data)) {
$status = "Dynamic DNS: (Error) Server-side error or maintenance";
} else {
$status = "Dynamic DNS: (Unknown Response)";
log_error("Dynamic DNS: PAYLOAD: {$data}");
$this->_debug($data);
}
} }
if($successful_update == true) { if($successful_update == true) {
......
...@@ -1553,6 +1553,7 @@ function services_dyndns_list() ...@@ -1553,6 +1553,7 @@ function services_dyndns_list()
'eurodns' => 'EuroDNS', 'eurodns' => 'EuroDNS',
'freedns' => 'freeDNS', 'freedns' => 'freeDNS',
'gratisdns' => 'GratisDNS', 'gratisdns' => 'GratisDNS',
'googledomains' => 'Google Domains',
'he-net' => 'HE.net', 'he-net' => 'HE.net',
'he-net-v6' => 'HE.net (v6)', 'he-net-v6' => 'HE.net (v6)',
'he-net-tunnelbroker' => 'HE.net Tunnelbroker', 'he-net-tunnelbroker' => 'HE.net Tunnelbroker',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment