From 48cac19640c5336bd162ae28a36cf99743916da4 Mon Sep 17 00:00:00 2001 From: yuki Niikura Date: Mon, 20 May 2019 16:40:19 +0000 Subject: [PATCH] Fixed regular expression. In python 2.7.13-2, if the 134th line of nip.py is as follows match = re.findall('^(?:.+\.)?(\d{1,3}([-.])\d{1,3}\2\d{1,3}\2\d{1,3})$', subdomain) The execution result of dig will be as follows. $ dig 1.2.3.4.example.com +short @localhost 127.0.0.1 $ As a result of correcting the 134th line as follows, match = re.findall('^(?:.+\.)?(\d{1,3}[-.]\d{1,3}[-.]\d{1,3}[-.]\d{1,3})$', subdomain) The execution result of dig is corrected as follows. $ dig 1-2-3-4.example.com +short @localhost 1.2.3.4 $ --- src/nip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nip.py b/src/nip.py index d7e2208..4a4e1d8 100755 --- a/src/nip.py +++ b/src/nip.py @@ -131,7 +131,7 @@ class DynamicBackend: def handle_subdomains(self, qname): subdomain = qname[0:qname.find(self.domain) - 1] - match = re.findall('^(?:.+\.)?(\d{1,3}([-.])\d{1,3}\2\d{1,3}\2\d{1,3})$', subdomain) + match = re.findall('^(?:.+\.)?(\d{1,3}[-.]\d{1,3}[-.]\d{1,3}[-.]\d{1,3})$', subdomain) if not match: if DEBUG: