]> git.ipfire.org Git - ddns.git/blobdiff - src/ddns/providers.py
namecheap: Fix undeclared variable.
[ddns.git] / src / ddns / providers.py
index 41078af2ecf86bb7a46cbfb2db28a80f5db3bdf0..6ac556444553fbf0d6e8b23854fe228ad6c81fc5 100644 (file)
@@ -161,6 +161,15 @@ class DDNSProvider(object):
                try:
                        self.update()
 
+               # 1) Catch network errors early, because we do not want to log
+               # them to the database. They are usually temporary and caused
+               # by the client side, so that we will retry quickly.
+               # 2) If there is an internet server error (HTTP code 500) on the
+               # provider's site, we will not log a failure and try again
+               # shortly.
+               except (DDNSNetworkError, DDNSInternalServerError):
+                       raise
+
                # In case of any errors, log the failed request and
                # raise the exception.
                except DDNSError as e:
@@ -1048,6 +1057,31 @@ class DDNSProviderFreeDNSAfraidOrg(DDNSProvider):
                raise DDNSUpdateError
 
 
+class DDNSProviderJoker(DDNSProtocolDynDNS2, DDNSProvider):
+               handle  = "joker.com"
+               name    = "Joker.com Dynamic DNS"
+               website = "https://joker.com/"
+               protocols = ("ipv4",)
+
+               # Information about the request can be found here:
+               # https://joker.com/faq/content/11/427/en/what-is-dynamic-dns-dyndns.html
+               # Using DynDNS V2 protocol over HTTPS here
+
+               url = "https://svc.joker.com/nic/update"
+
+
+class DDNSProviderGoogle(DDNSProtocolDynDNS2, DDNSProvider):
+        handle    = "domains.google.com"
+        name      = "Google Domains"
+        website   = "https://domains.google.com/"
+        protocols = ("ipv4",)
+
+        # Information about the format of the HTTP request is to be found
+        # here: https://support.google.com/domains/answer/6147083?hl=en
+
+        url = "https://domains.google.com/nic/update"
+
+
 class DDNSProviderLightningWireLabs(DDNSProvider):
        handle    = "dns.lightningwirelabs.com"
        name      = "Lightning Wire Labs DNS Service"
@@ -1091,6 +1125,18 @@ class DDNSProviderLightningWireLabs(DDNSProvider):
                raise DDNSUpdateError
 
 
+class DDNSProviderLoopia(DDNSProtocolDynDNS2, DDNSProvider):
+       handle    = "loopia.se"
+       name      = "Loopia AB"
+       website   = "https://www.loopia.com"
+       protocols = ("ipv4",)
+
+       # Information about the format of the HTTP request is to be found
+       # here: https://support.loopia.com/wiki/About_the_DynDNS_support
+
+       url = "https://dns.loopia.se/XDynDNSServer/XDynDNS.php"
+
+
 class DDNSProviderMyOnlinePortal(DDNSProtocolDynDNS2, DDNSProvider):
        handle    = "myonlineportal.net"
        name      = "myonlineportal.net"
@@ -1127,8 +1173,11 @@ class DDNSProviderNamecheap(DDNSResponseParserXML, DDNSProvider):
                # Namecheap requires the hostname splitted into a host and domain part.
                host, domain = self.hostname.split(".", 1)
 
+               # Get and store curent IP address.
+               address = self.get_address(proto)
+
                data = {
-                       "ip"       : self.get_address(proto),
+                       "ip"       : address,
                        "password" : self.password,
                        "host"     : host,
                        "domain"   : domain
@@ -1387,6 +1436,15 @@ class DDNSProviderStrato(DDNSProtocolDynDNS2, DDNSProvider):
 
        url = "https://dyndns.strato.com/nic/update"
 
+       def prepare_request_data(self, proto):
+               data = DDNSProtocolDynDNS2.prepare_request_data(self, proto)
+               data.update({
+                       "mx" : "NOCHG",
+                       "backupmx" : "NOCHG"
+               })
+
+               return data
+
 
 class DDNSProviderTwoDNS(DDNSProtocolDynDNS2, DDNSProvider):
        handle    = "twodns.de"
@@ -1497,6 +1555,54 @@ class DDNSProviderZoneedit(DDNSProvider):
                raise DDNSUpdateError
 
 
+class DDNSProviderDNSmadeEasy(DDNSProvider):
+       handle    = "dnsmadeeasy.com"
+       name      = "DNSmadeEasy.com"
+       website   = "http://www.dnsmadeeasy.com/"
+       protocols = ("ipv4",)
+
+       # DNS Made Easy Nameserver Provider also offering Dynamic DNS
+       # Documentation can be found here:
+       # http://www.dnsmadeeasy.com/dynamic-dns/
+
+       url = "https://cp.dnsmadeeasy.com/servlet/updateip?"
+       can_remove_records = False
+
+       def update_protocol(self, proto):
+               data = {
+                       "ip" : self.get_address(proto),
+                       "id" : self.hostname,
+                       "username" : self.username,
+                       "password" : self.password,
+               }
+
+               # Send update to the server.
+               response = self.send_request(self.url, data=data)
+
+               # Get the full response message.
+               output = response.read()
+
+               # Handle success messages.
+               if output.startswith("success") or output.startswith("error-record-ip-same"):
+                       return
+
+               # Handle error codes.
+               if output.startswith("error-auth-suspend"):
+                       raise DDNSRequestError(_("Account has been suspended."))
+
+               elif output.startswith("error-auth-voided"):
+                       raise DDNSRequestError(_("Account has been revoked."))
+
+               elif output.startswith("error-record-invalid"):
+                       raise DDNSRequestError(_("Specified host does not exist."))
+
+               elif output.startswith("error-auth"):
+                       raise DDNSAuthenticationError
+
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError(_("Server response: %s") % output)
+
+
 class DDNSProviderZZZZ(DDNSProvider):
        handle    = "zzzz.io"
        name      = "zzzz"