summaryrefslogtreecommitdiff
path: root/ipaddr.py
diff options
context:
space:
mode:
authorPeter Moody <pmoody@google.com>2011-01-13 20:59:05 +0000
committerPeter Moody <pmoody@google.com>2011-01-13 20:59:05 +0000
commit9fd78a2f9a7baffe7c3251663c4ef1e9ece28501 (patch)
treed4305d935de08b7c343bacd350f267b60b625981 /ipaddr.py
parent2c2d0f01693aeefd8b0a1c5fa0a2d10494c4883e (diff)
downloadipaddr-py-9fd78a2f9a7baffe7c3251663c4ef1e9ece28501.tar.gz
+ turn teredo and sixtofour into properties.
+ 2.1.7 release. git-svn-id: https://ipaddr-py.googlecode.com/svn/trunk@203 09200d28-7f98-11dd-ad27-0f66e57d2035
Diffstat (limited to 'ipaddr.py')
-rw-r--r--ipaddr.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/ipaddr.py b/ipaddr.py
index 261f3e2..d1d98a2 100644
--- a/ipaddr.py
+++ b/ipaddr.py
@@ -1749,32 +1749,34 @@ class _BaseV6(object):
except AddressValueError:
return None
+ @property
def teredo(self):
"""Tuple of embedded teredo IPs.
Returns:
- Tuple of the (server, client) IPs or False if the address
+ Tuple of the (server, client) IPs or None if the address
doesn't appear to be a teredo address (doesn't start with
2001)
"""
bits = self._explode_shorthand_ip_string().split(':')
if not bits[0] == '2001':
- return False
+ return None
return (IPv4Address(int(''.join(bits[2:4]), 16)),
IPv4Address(int(''.join(bits[6:]), 16) ^ 0xFFFFFFFF))
+ @property
def sixtofour(self):
"""Return the IPv4 6to4 embedded address.
Returns:
- The IPv4 6to4-embedded address if present or False if the
+ The IPv4 6to4-embedded address if present or None if the
address doesn't appear to contain a 6to4 embedded address.
"""
bits = self._explode_shorthand_ip_string().split(':')
if not bits[0] == '2002':
- return False
+ return None
return IPv4Address(int(''.join(bits[1:3]), 16))