summaryrefslogtreecommitdiff
path: root/dns/ipv6.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2014-05-31 11:17:38 -0700
committerBob Halley <halley@dnspython.org>2014-05-31 11:17:38 -0700
commit7a277cecc6227edf746a40dbad250503ef3f7d20 (patch)
treecb4b9282a7e2114eb653bdc662c760f46241b65f /dns/ipv6.py
parentc8e17fc02a2d3ebbee3e7c34cd7828858e13fe57 (diff)
downloaddnspython-7a277cecc6227edf746a40dbad250503ef3f7d20.tar.gz
Add dns.ipv6.is_mapped(); Reverse IPv6 mapped IPv4 into v4 space
Diffstat (limited to 'dns/ipv6.py')
-rw-r--r--dns/ipv6.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/dns/ipv6.py b/dns/ipv6.py
index 1ab00da..bf658af 100644
--- a/dns/ipv6.py
+++ b/dns/ipv6.py
@@ -161,3 +161,8 @@ def inet_aton(text):
return text.decode('hex_codec')
except TypeError:
raise dns.exception.SyntaxError
+
+_mapped_prefix = '\x00' * 10 + '\xff\xff'
+
+def is_mapped(address):
+ return address.startswith(_mapped_prefix)