diff options
author | Peter Moody <pmoody@google.com> | 2011-01-13 20:59:05 +0000 |
---|---|---|
committer | Peter Moody <pmoody@google.com> | 2011-01-13 20:59:05 +0000 |
commit | 9fd78a2f9a7baffe7c3251663c4ef1e9ece28501 (patch) | |
tree | d4305d935de08b7c343bacd350f267b60b625981 /ipaddr.py | |
parent | 2c2d0f01693aeefd8b0a1c5fa0a2d10494c4883e (diff) | |
download | ipaddr-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.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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)) |