Add support for dy.fi

Message ID 20180628110153.1776493-1-michael.tremer@ipfire.org
State Accepted
Commit 9db9ea2539cfdeac4d12efad06156d34cf87bba1
Headers
Series Add support for dy.fi |

Commit Message

Michael Tremer June 28, 2018, 9:01 p.m. UTC
  From: Mauno Pirnes <mauno.pirnes@kotinet.com>

DyFi is a provider from Finland that only allows to point dynamic
DNS records to IP addresses that are registered in Finland.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 README                |  1 +
 src/ddns/providers.py | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)
  

Patch

diff --git a/README b/README
index d1708584cb14..02ac926762ce 100644
--- a/README
+++ b/README
@@ -60,6 +60,7 @@  SUPPORTED PROVIDERS:
 	domopoli.de
 	dtdns.com
 	duckdns.org
+	dy.fi
 	dyndns.org
 	dyns.cx|net
 	dynu.com
diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index ea723e591667..828787872c18 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -400,6 +400,8 @@  class DDNSProtocolDynDNS2(object):
 			raise DDNSInternalServerError(_("DNS error encountered"))
 		elif output == "badagent":
 			raise DDNSBlockedError
+		elif output == "badip":
+			raise DDNSBlockedError
 
 		# If we got here, some other update error happened.
 		raise DDNSUpdateError(_("Server response: %s") % output)
@@ -828,6 +830,24 @@  class DDNSProviderDuckDNS(DDNSProtocolDynDNS2, DDNSProvider):
 	url = "https://www.duckdns.org/nic/update"
 
 
+class DDNSProviderDyFi(DDNSProtocolDynDNS2, DDNSProvider):
+	handle    = "dy.fi"
+	name      = "dy.fi"
+	website   = "https://www.dy.fi/"
+	protocols = ("ipv4",)
+
+	# Information about the format of the request is to be found
+	# https://www.dy.fi/page/clients?lang=en
+	# https://www.dy.fi/page/specification?lang=en
+
+	url = "http://www.dy.fi/nic/update"
+
+	# Please only send automatic updates when your IP address changes,
+	# or once per 5 to 6 days to refresh the address mapping (they will
+	# expire if not refreshed within 7 days).
+	holdoff_days = 6
+
+
 class DDNSProviderDynDNS(DDNSProtocolDynDNS2, DDNSProvider):
 	handle    = "dyndns.org"
 	name      = "Dyn"