mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
dns/dyndns: add support for 1984Hosting (#1952)
This commit is contained in:
@@ -96,6 +96,7 @@ function dyndns_list()
|
||||
*/
|
||||
|
||||
return array(
|
||||
'1984-hosting' => '1984 Hosting Company',
|
||||
'3322' => '3322',
|
||||
'all-inkl' => 'All-Inkl',
|
||||
'all-inkl-v6' => 'All-Inkl (v6)',
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* - _debug()
|
||||
* - _checkIP()
|
||||
* +----------------------------------------------------+
|
||||
* 1984 Hosting Company - Last Tested: 03 August 2020
|
||||
* 3322 - Last Tested: 26 May 2017
|
||||
* All-Inkl - Last Tested: 02 March 2020
|
||||
* Amazon Route53 - Last Tested: 01 April 2012
|
||||
@@ -168,6 +169,7 @@ class updatedns
|
||||
case 'linode':
|
||||
case 'linode-v6':
|
||||
case 'namecheap':
|
||||
case '1984-hosting':
|
||||
if (!$dnsPass) {
|
||||
$this->_error(4);
|
||||
} elseif (!$dnsHost) {
|
||||
@@ -304,6 +306,7 @@ class updatedns
|
||||
$this->_error(10);
|
||||
} else {
|
||||
switch ($this->_dnsService) {
|
||||
case '1984-hosting':
|
||||
case '3322':
|
||||
case 'all-inkl':
|
||||
case 'all-inkl-v6':
|
||||
@@ -1031,6 +1034,11 @@ class updatedns
|
||||
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||
}
|
||||
break;
|
||||
case '1984-hosting':
|
||||
$server = "https://api.1984.is/1.0/freedns/?apikey={$this->_dnsPass}&domain={$this->_dnsHost}&ip={$this->_dnsIP}";
|
||||
curl_setopt($ch, CURLOPT_URL, $server);
|
||||
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||
break;
|
||||
case '3322':
|
||||
$server = "http://members.3322.net/dyndns/update?hostname={$this->_dnsHost}&myip={$this->_dnsIP}";
|
||||
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser . ':' . $this->_dnsPass);
|
||||
@@ -1643,6 +1651,22 @@ class updatedns
|
||||
$this->_debug($data);
|
||||
}
|
||||
break;
|
||||
case '1984-hosting':
|
||||
$output = json_decode($data);
|
||||
if ($output === null) {
|
||||
$status = "Dynamic DNS ({$this->_dnsHost}): ERROR - empty response.";
|
||||
} elseif ($output->ok === true) {
|
||||
$status = "Dynamic DNS: (Success) {$this->_dnsHost} updated to {$this->_dnsIP}";
|
||||
$successful_update = true;
|
||||
} elseif ($output->error) {
|
||||
$status = "Dynamic DNS ({$this->_dnsHost}): ERROR - Invalid Credentials! Don't forget to use API Key for password field with 1984 Hosting Company.";
|
||||
} elseif ($output->lookup) {
|
||||
$status = "Dynamic DNS ({$this->_dnsHost}): ERROR - Zone ID was not found.";
|
||||
} else {
|
||||
$status = "Dynamic DNS ({$this->_dnsHost}): UNKNOWN ERROR - {$output->errors[0]->message}";
|
||||
log_error("Dynamic DNS ({$this->_dnsHost}): PAYLOAD: {$data}");
|
||||
}
|
||||
break;
|
||||
case '3322':
|
||||
case 'citynetwork':
|
||||
case 'dnsomatic':
|
||||
|
||||
@@ -75,7 +75,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
$input_errors = array();
|
||||
$pconfig = $_POST;
|
||||
if(($pconfig['type'] == "freedns" || $pconfig['type'] == "linode" || $pconfig['type'] == "linode-v6" || $pconfig['type'] == "namecheap" || $pconfig['type'] == "cloudflare-token" || $pconfig['type'] == "cloudflare-token-v6" || $pconfig['type'] == "desec" || $pconfig['type'] == "desec-v4-v6" || $pconfig['type'] == "desec-v6") && $pconfig['username'] == "") {
|
||||
|
||||
if(($pconfig['type'] == "freedns" || $pconfig['type'] == "linode" || $pconfig['type'] == "linode-v6" || $pconfig['type'] == "namecheap" || $pconfig['type'] == "cloudflare-token" || $pconfig['type'] == "cloudflare-token-v6" || $pconfig['type'] == "desec" || $pconfig['type'] == "desec-v4-v6" || $pconfig['type'] == "desec-v6" || $pconfig['type'] == "1984-hosting") && $pconfig['username'] == "") {
|
||||
$pconfig['username'] = "none";
|
||||
}
|
||||
|
||||
@@ -128,6 +129,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
case 'linode':
|
||||
case 'linode-v6':
|
||||
case 'namecheap':
|
||||
case '1984-hosting':
|
||||
$host_to_check = preg_replace('/^[@*]\./', '', $host_to_check);
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user