.. attribute:: is_global
- ``True`` if the address is allocated for private networks. See
+ ``True`` if the address is allocated for public networks. See
iana-ipv4-special-registry (for IPv4) or iana-ipv6-special-registry
(for IPv6).
@property
def is_global(self):
- """Test if this address is allocated for private networks.
+ """Test if this address is allocated for public networks.
Returns:
A boolean, True if the address is not reserved per
return self in reserved_network
@property
+ @functools.lru_cache()
def is_private(self):
"""Test if this address is allocated for private networks.
@property
def is_global(self):
- """Test if this address is allocated for private networks.
+ """Test if this address is allocated for public networks.
Returns:
A boolean, True if the address is not reserved per
iana-ipv4-special-registry.
"""
- return not self.is_private
+ return self in IPv4Network('100.64.0.0/10') or not self.is_private
@property
return self in sitelocal_network
@property
+ @functools.lru_cache()
def is_private(self):
"""Test if this address is allocated for private networks.
'127.42.0.0/16').is_loopback)
self.assertEqual(False, ipaddress.ip_network('128.0.0.0').is_loopback)
self.assertEqual(True, ipaddress.ip_network('100.64.0.0/10').is_private)
+ self.assertEqual(False, ipaddress.ip_network('100.64.0.0/10').is_global)
self.assertEqual(True,
ipaddress.ip_network('192.0.2.128/25').is_private)
self.assertEqual(True,