@@ -1333,18 +1333,38 @@ def is_reserved(self):
1333
1333
@property
1334
1334
@functools .lru_cache ()
1335
1335
def is_private (self ):
1336
- """Test if this address is allocated for private networks.
1336
+ """``True`` if the address is defined as not globally reachable by
1337
+ iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
1338
+ (for IPv6) with the following exceptions:
1337
1339
1338
- Returns:
1339
- A boolean, True if the address is reserved per
1340
- iana-ipv4-special-registry.
1340
+ * ``is_private`` is ``False`` for ``100.64.0.0/10``
1341
+ * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
1342
+ semantics of the underlying IPv4 addresses and the following condition holds
1343
+ (see :attr:`IPv6Address.ipv4_mapped`)::
1344
+
1345
+ address.is_private == address.ipv4_mapped.is_private
1341
1346
1347
+ ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
1348
+ IPv4 range where they are both ``False``.
1342
1349
"""
1343
1350
return any (self in net for net in self ._constants ._private_networks )
1344
1351
1345
1352
@property
1346
1353
@functools .lru_cache ()
1347
1354
def is_global (self ):
1355
+ """``True`` if the address is defined as globally reachable by
1356
+ iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
1357
+ (for IPv6) with the following exception:
1358
+
1359
+ For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
1360
+ semantics of the underlying IPv4 addresses and the following condition holds
1361
+ (see :attr:`IPv6Address.ipv4_mapped`)::
1362
+
1363
+ address.is_global == address.ipv4_mapped.is_global
1364
+
1365
+ ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
1366
+ IPv4 range where they are both ``False``.
1367
+ """
1348
1368
return self not in self ._constants ._public_network and not self .is_private
1349
1369
1350
1370
@property
@@ -2049,13 +2069,19 @@ def is_site_local(self):
2049
2069
@property
2050
2070
@functools .lru_cache ()
2051
2071
def is_private (self ):
2052
- """Test if this address is allocated for private networks.
2072
+ """``True`` if the address is defined as not globally reachable by
2073
+ iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
2074
+ (for IPv6) with the following exceptions:
2053
2075
2054
- Returns:
2055
- A boolean, True if the address is reserved per
2056
- iana-ipv6-special-registry, or is ipv4_mapped and is
2057
- reserved in the iana-ipv4-special-registry.
2076
+ * ``is_private`` is ``False`` for ``100.64.0.0/10``
2077
+ * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
2078
+ semantics of the underlying IPv4 addresses and the following condition holds
2079
+ (see :attr:`IPv6Address.ipv4_mapped`)::
2080
+
2081
+ address.is_private == address.ipv4_mapped.is_private
2058
2082
2083
+ ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
2084
+ IPv4 range where they are both ``False``.
2059
2085
"""
2060
2086
ipv4_mapped = self .ipv4_mapped
2061
2087
if ipv4_mapped is not None :
@@ -2064,12 +2090,18 @@ def is_private(self):
2064
2090
2065
2091
@property
2066
2092
def is_global (self ):
2067
- """Test if this address is allocated for public networks.
2093
+ """``True`` if the address is defined as globally reachable by
2094
+ iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
2095
+ (for IPv6) with the following exception:
2068
2096
2069
- Returns:
2070
- A boolean, true if the address is not reserved per
2071
- iana-ipv6-special-registry.
2097
+ For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
2098
+ semantics of the underlying IPv4 addresses and the following condition holds
2099
+ (see :attr:`IPv6Address.ipv4_mapped`)::
2100
+
2101
+ address.is_global == address.ipv4_mapped.is_global
2072
2102
2103
+ ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
2104
+ IPv4 range where they are both ``False``.
2073
2105
"""
2074
2106
return not self .is_private
2075
2107
0 commit comments