DynDNS - Updated No-Ip client code to use APIv2 which also supports g… (#1836)

This commit is contained in:
Victor Kislov 2021-04-21 10:48:43 +03:00 committed by GitHub
parent 4140a8afb0
commit 98548b2781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 50 deletions

View File

@ -47,7 +47,7 @@
* Linode - Last Tested: 25 February 2020
* Linode v6 - Last Tested: 25 February 2020
* Namecheap - Last Tested: 31 August 2010
* No-IP - Last Tested: 20 July 2008
* No-IP - Last Tested: 15 May 2020
* ODS - Last Tested: 02 August 2005
* Oray - Last Tested: 26 May 2017
* STRATO - Last Tested: 09 May 2017
@ -446,8 +446,11 @@ class updatedns
break;
case 'noip':
case 'noip-free':
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$server = "https://dynupdate.no-ip.com/ducupdate.php";
curl_setopt_array($ch, [
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_USERPWD => $this->_dnsUser.':'.$this->_dnsPass
]);
$server = "https://dynupdate.no-ip.com/nic/update";
$port = "";
if ($this->_dnsServer) {
$server = $this->_dnsServer;
@ -467,7 +470,7 @@ class updatedns
} else {
$iptoset = $this->_dnsIP;
}
curl_setopt($ch, CURLOPT_URL, $server . $port . '?username=' . urlencode($this->_dnsUser) . '&pass=' . urlencode($this->_dnsPass) . '&hostname=' . $this->_dnsHost . '&ip=' . $iptoset);
curl_setopt($ch, CURLOPT_URL, $server . $port . '?hostname=' . $this->_dnsHost.'&myip=' . $iptoset);
break;
case 'easydns':
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
@ -1323,63 +1326,36 @@ class updatedns
break;
case 'noip':
case 'noip-free':
list($ip,$code) = explode(":", $data);
$noIpPrc = explode(' ', $data);
$code = $noIpPrc[0];
$ip = isset($noIpPrc[1]) ? $noIpPrc[1] : 'n/a';
switch ($code) {
case 0:
$status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP address is current, no update performed.";
$successful_update = true;
break;
case 1:
case 'good':
$status = "Dynamic DNS ({$this->_dnsHost}): (Success) DNS hostname update successful.";
$successful_update = true;
break;
case 2:
case 'nochg':
$status = "Dynamic DNS ({$this->_dnsHost}): (Success) IP address is current, no update performed.";
$successful_update = true;
break;
case 'nohost':
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Hostname supplied does not exist.";
break;
case 3:
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Invalid Username.";
case 'badauth':
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Invalid Username or Password.";
break;
case 4:
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Invalid Password.";
case 'badagent':
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Client disabled. Client should exit and not perform any more updates without user intervention.";
break;
case 5:
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) To many updates sent.";
case '!donate':
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Requested update feature only available to Enhanced subscribers.";
break;
case 6:
case '911':
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) No-IP servers currently experiencing outages. Retry no sooner than 30 minutes.";
break;
case 'abuse':
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Account disabled due to violation of No-IP terms of service.";
break;
case 7:
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Invalid IP. IP Address submitted is improperly formatted or is a private IP address or is on a blacklist.";
break;
case 8:
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Disabled / Locked Hostname.";
break;
case 9:
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Host updated is configured as a web redirect and no update was performed.";
break;
case 10:
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Group supplied does not exist.";
break;
case 11:
$status = "Dynamic DNS ({$this->_dnsHost}): (Success) DNS group update is successful.";
$successful_update = true;
break;
case 12:
$status = "Dynamic DNS ({$this->_dnsHost}): (Success) DNS group is current, no update performed.";
$successful_update = true;
break;
case 13:
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Update client support not available for supplied hostname or group.";
break;
case 14:
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Hostname supplied does not have offline settings configured.";
break;
case 99:
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Client disabled. Client should exit and not perform any more updates without user intervention.";
break;
case 100:
$status = "Dynamic DNS ({$this->_dnsHost}): (Error) Client disabled. Client should exit and not perform any more updates without user intervention.";
break;
default:
$status = "Dynamic DNS ({$this->_dnsHost}): (Unknown Response)";
$this->_debug("Unknown Response: " . $data);