return self.core.system.get_address(proto) or default
+class DDNSProtocolDynDNS2(object):
+ """
+ This is an abstract class that implements the DynDNS updater
+ protocol version 2. As this is a popular way to update dynamic
+ DNS records, this class is supposed make the provider classes
+ shorter and simpler.
+ """
+
+ # Information about the format of the request is to be found
+ # http://http://dyn.com/support/developers/api/perform-update/
+ # http://dyn.com/support/developers/api/return-codes/
+
+ def _prepare_request_data(self):
+ data = {
+ "hostname" : self.hostname,
+ "myip" : self.get_address("ipv4"),
+ }
+
+ return data
+
+ def update(self):
+ data = self._prepare_request_data()
+
+ # Send update to the server.
+ response = self.send_request(self.url, data=data,
+ username=self.username, password=self.password)
+
+ # Get the full response message.
+ output = response.read()
+
+ # Handle success messages.
+ if output.startswith("good") or output.startswith("nochg"):
+ return
+
+ # Handle error codes.
+ if output == "badauth":
+ raise DDNSAuthenticationError
+ elif output == "aduse":
+ raise DDNSAbuseError
+ elif output == "notfqdn":
+ raise DDNSRequestError(_("No valid FQDN was given."))
+ elif output == "nohost":
+ raise DDNSRequestError(_("Specified host does not exist."))
+ elif output == "911":
+ raise DDNSInternalServerError
+ elif output == "dnserr":
+ raise DDNSInternalServerError(_("DNS error encountered."))
+
+ # If we got here, some other update error happened.
+ raise DDNSUpdateError(_("Server response: %s") % output)
+
+
class DDNSProviderAllInkl(DDNSProvider):
handle = "all-inkl.com"
name = "All-inkl.com"
raise DDNSUpdateError
-class DDNSProviderDynDNS(DDNSProvider):
+class DDNSProviderDynDNS(DDNSProtocolDynDNS2, DDNSProvider):
handle = "dyndns.org"
name = "Dyn"
website = "http://dyn.com/dns/"
url = "https://members.dyndns.org/nic/update"
- def _prepare_request_data(self):
- data = {
- "hostname" : self.hostname,
- "myip" : self.get_address("ipv4"),
- }
-
- return data
-
- def update(self):
- data = self._prepare_request_data()
-
- # Send update to the server.
- response = self.send_request(self.url, data=data,
- username=self.username, password=self.password)
-
- # Get the full response message.
- output = response.read()
-
- # Handle success messages.
- if output.startswith("good") or output.startswith("nochg"):
- return
- # Handle error codes.
- if output == "badauth":
- raise DDNSAuthenticationError
- elif output == "aduse":
- raise DDNSAbuseError
- elif output == "notfqdn":
- raise DDNSRequestError(_("No valid FQDN was given."))
- elif output == "nohost":
- raise DDNSRequestError(_("Specified host does not exist."))
- elif output == "911":
- raise DDNSInternalServerError
- elif output == "dnserr":
- raise DDNSInternalServerError(_("DNS error encountered."))
-
- # If we got here, some other update error happened.
- raise DDNSUpdateError(_("Server response: %s") % output)
-
-
-class DDNSProviderDynU(DDNSProviderDynDNS):
+class DDNSProviderDynU(DDNSProtocolDynDNS2, DDNSProvider):
handle = "dynu.com"
name = "Dynu"
website = "http://dynu.com/"
return data
-class DDNSProviderEasyDNS(DDNSProviderDynDNS):
- handle = "easydns.com"
- name = "EasyDNS"
- website = "http://www.easydns.com/"
+class DDNSProviderEasyDNS(DDNSProtocolDynDNS2, DDNSProvider):
+ handle = "easydns.com"
+ name = "EasyDNS"
+ website = "http://www.easydns.com/"
+ protocols = ("ipv4",)
# There is only some basic documentation provided by the vendor,
# also searching the web gain very poor results.
raise DDNSUpdateError
-class DDNSProviderNOIP(DDNSProviderDynDNS):
- handle = "no-ip.com"
- name = "No-IP"
- website = "http://www.no-ip.com/"
+class DDNSProviderNOIP(DDNSProtocolDynDNS2, DDNSProvider):
+ handle = "no-ip.com"
+ name = "No-IP"
+ website = "http://www.no-ip.com/"
+ protocols = ("ipv4",)
# Information about the format of the HTTP request is to be found
# here: http://www.no-ip.com/integrate/request and
return data
-class DDNSProviderOVH(DDNSProviderDynDNS):
- handle = "ovh.com"
- name = "OVH"
- website = "http://www.ovh.com/"
+class DDNSProviderOVH(DDNSProtocolDynDNS2, DDNSProvider):
+ handle = "ovh.com"
+ name = "OVH"
+ website = "http://www.ovh.com/"
+ protocols = ("ipv4",)
# OVH only provides very limited information about how to
# update a DynDNS host. They only provide the update url
url = "https://www.ovh.com/nic/update"
def _prepare_request_data(self):
- data = DDNSProviderDynDNS._prepare_request_data(self)
+ data = DDNSProtocolDynDNS2._prepare_request_data(self)
data.update({
"system" : "dyndns",
})
raise DDNSUpdateError
-class DDNSProviderSelfhost(DDNSProviderDynDNS):
+class DDNSProviderSelfhost(DDNSProtocolDynDNS2, DDNSProvider):
handle = "selfhost.de"
name = "Selfhost.de"
website = "http://www.selfhost.de/"
+ protocols = ("ipv4",)
url = "https://carol.selfhost.de/nic/update"
return data
-class DDNSProviderSPDNS(DDNSProviderDynDNS):
- handle = "spdns.org"
- name = "SPDNS"
- website = "http://spdns.org/"
+class DDNSProviderSPDNS(DDNSProtocolDynDNS2, DDNSProvider):
+ handle = "spdns.org"
+ name = "SPDNS"
+ website = "http://spdns.org/"
+ protocols = ("ipv4",)
# Detailed information about request and response codes are provided
# by the vendor. They are using almost the same mechanism and status
url = "https://update.spdns.de/nic/update"
-class DDNSProviderStrato(DDNSProviderDynDNS):
- handle = "strato.com"
- name = "Strato AG"
- website = "http:/www.strato.com/"
+class DDNSProviderStrato(DDNSProtocolDynDNS2, DDNSProvider):
+ handle = "strato.com"
+ name = "Strato AG"
+ website = "http:/www.strato.com/"
+ protocols = ("ipv4",)
# Information about the request and response can be obtained here:
# http://www.strato-faq.de/article/671/So-einfach-richten-Sie-DynDNS-f%C3%BCr-Ihre-Domains-ein.html
url = "https://dyndns.strato.com/nic/update"
-class DDNSProviderTwoDNS(DDNSProviderDynDNS):
- handle = "twodns.de"
- name = "TwoDNS"
- website = "http://www.twodns.de"
+class DDNSProviderTwoDNS(DDNSProtocolDynDNS2, DDNSProvider):
+ handle = "twodns.de"
+ name = "TwoDNS"
+ website = "http://www.twodns.de"
+ protocols = ("ipv4",)
# Detailed information about the request can be found here
# http://twodns.de/en/faqs
return data
-class DDNSProviderUdmedia(DDNSProviderDynDNS):
- handle = "udmedia.de"
- name = "Udmedia GmbH"
- website = "http://www.udmedia.de"
+class DDNSProviderUdmedia(DDNSProtocolDynDNS2, DDNSProvider):
+ handle = "udmedia.de"
+ name = "Udmedia GmbH"
+ website = "http://www.udmedia.de"
+ protocols = ("ipv4",)
# Information about the request can be found here
# http://www.udmedia.de/faq/content/47/288/de/wie-lege-ich-einen-dyndns_eintrag-an.html
url = "https://www.udmedia.de/nic/update"
-class DDNSProviderVariomedia(DDNSProviderDynDNS):
+class DDNSProviderVariomedia(DDNSProtocolDynDNS2, DDNSProvider):
handle = "variomedia.de"
name = "Variomedia"
website = "http://www.variomedia.de/"
return data
-class DDNSProviderZoneedit(DDNSProvider):
- handle = "zoneedit.com"
- name = "Zoneedit"
- website = "http://www.zoneedit.com"
+class DDNSProviderZoneedit(DDNSProtocolDynDNS2, DDNSProvider):
+ handle = "zoneedit.com"
+ name = "Zoneedit"
+ website = "http://www.zoneedit.com"
+ protocols = ("ipv4",)
# Detailed information about the request and the response codes can be
# obtained here: