]> git.ipfire.org Git - oddments/ddns.git/blobdiff - src/ddns/providers.py
Add all-inkl.com as new provider.
[oddments/ddns.git] / src / ddns / providers.py
index f79890dedaef46bff54f47ed1247f6970fc41b53..f4944be255e808712ce239f5ccbe212567e6231d 100644 (file)
@@ -20,6 +20,7 @@
 ###############################################################################
 
 import logging
+import urllib2
 
 from i18n import _
 
@@ -167,6 +168,47 @@ class DDNSProvider(object):
                return self.core.system.get_address(proto)
 
 
+class DDNSProviderAllInkl(DDNSProvider):
+       INFO = {
+               "handle"    : "all-inkl.com",
+               "name"      : "All-inkl.com",
+               "website"   : "http://all-inkl.com/",
+               "protocols" : ["ipv4",]
+       }
+
+       # There are only information provided by the vendor how to
+       # perform an update on a FRITZ Box. Grab requried informations
+       # from the net.
+       # http://all-inkl.goetze.it/v01/ddns-mit-einfachen-mitteln/
+
+       url = "http://dyndns.kasserver.com"
+
+       def update(self):
+
+               # There is no additional data required so we directly can
+               # send our request.
+               try:
+                       # Send request to the server.
+                       response = self.send_request(self.url, username=self.username, password=self.password)
+
+                       # Handle 401 HTTP Header (Authentication Error)
+               except urllib2.HTTPError, e:
+                       if e.code == 401:
+                               raise DDNSAuthenticationError
+
+                       raise
+
+               # Get the full response message.
+               output = response.read()
+
+               # Handle success messages.
+               if output.startswith("good") or output.startswith("nochg"):
+                       return
+
+               # If we got here, some other update error happened.
+               raise DDNSUpdateError
+
+
 class DDNSProviderDHS(DDNSProvider):
        INFO = {
                "handle"    : "dhs.org",
@@ -361,6 +403,32 @@ class DDNSProviderDynDNS(DDNSProvider):
                raise DDNSUpdateError
 
 
+class DDNSProviderDynU(DDNSProviderDynDNS):
+       INFO = {
+               "handle"    : "dynu.com",
+               "name"      : "Dynu",
+               "website"   : "http://dynu.com/",
+               "protocols" : ["ipv6", "ipv4",]
+       }
+
+
+       # Detailed information about the request and response codes
+       # are available on the providers webpage.
+       # http://dynu.com/Default.aspx?page=dnsapi
+
+       url = "https://api.dynu.com/nic/update"
+
+       def _prepare_request_data(self):
+               data = DDNSProviderDynDNS._prepare_request_data(self)
+
+               # This one supports IPv6
+               data.update({
+                       "myipv6"   : self.get_address("ipv6"),
+               })
+
+               return data
+
+
 class DDNSProviderEasyDNS(DDNSProviderDynDNS):
        INFO = {
                "handle"    : "easydns.com",
@@ -518,11 +586,12 @@ class DDNSProviderOVH(DDNSProviderDynDNS):
        url = "https://www.ovh.com/nic/update"
 
        def _prepare_request_data(self):
-               data = {
-                       "hostname" : self.hostname,
-                       "myip"     : self.get_address("ipv4"),
-                       "system"   : "dyndns",
-               }
+               data = DDNSProviderDynDNS._prepare_request_data(self)
+               data.update({
+                       "system" : "dyndns",
+               })
+
+               return data
 
 
 class DDNSProviderRegfish(DDNSProvider):
@@ -663,3 +732,5 @@ class DDNSProviderVariomedia(DDNSProviderDynDNS):
                        "hostname" : self.hostname,
                        "myip"     : self.get_address(self.proto)
                }
+
+               return data