|
30 | 30 | 'long2ip', |
31 | 31 | 'validate_cidr', |
32 | 32 | 'validate_ip', |
| 33 | + 'DOCUMENTATION_NETWORK', |
| 34 | + 'IPV4_MAPPED', |
| 35 | + 'IPV6_TO_IPV4_NETWORK', |
| 36 | + 'LINK_LOCAL', |
| 37 | + 'LOCALHOST', |
| 38 | + 'LOOPBACK', |
33 | 39 | 'MAX_IP', |
34 | 40 | 'MIN_IP', |
| 41 | + 'MULTICAST', |
| 42 | + 'MULTICAST_GLOBAL', |
| 43 | + 'MULTICAST_LOCAL', |
| 44 | + 'MULTICAST_LOCAL_DHCP', |
| 45 | + 'MULTICAST_LOCAL_NODES', |
| 46 | + 'MULTICAST_LOCAL_ROUTERS', |
| 47 | + 'MULTICAST_LOOPBACK', |
| 48 | + 'MULTICAST_SITE', |
| 49 | + 'MULTICAST_SITE', |
| 50 | + 'MULTICAST_SITE_DHCP', |
| 51 | + 'PRIVATE_NETWORK', |
| 52 | + 'TEREDO_NETWORK', |
| 53 | + 'UNSPECIFIED_ADDRESS', |
35 | 54 | ) |
36 | 55 |
|
37 | 56 |
|
|
53 | 72 | #: Minimum IPv6 integer |
54 | 73 | MIN_IP = 0x0 |
55 | 74 |
|
| 75 | +#: Absence of an address (only valid as source address) |
| 76 | +#: (`RFC 4291 <https://tools.ietf.org/html/rfc4291>`_) |
| 77 | +UNSPECIFIED_ADDRESS = "::/128" |
| 78 | + |
| 79 | +#: Loopback addresses on the local host |
| 80 | +#: (`RFC 4291 <https://tools.ietf.org/html/rfc4291>`_) |
| 81 | +LOOPBACK = "::1/128" |
| 82 | + |
| 83 | +#: Common `localhost` address |
| 84 | +#: (`RFC 4291 <https://tools.ietf.org/html/rfc4291>`_) |
| 85 | +LOCALHOST = LOOPBACK |
| 86 | + |
| 87 | +#: IPv4 mapped to IPv6 (not globally routable) |
| 88 | +#: (`RFC 4291 <https://tools.ietf.org/html/rfc4291>`_) |
| 89 | +IPV4_MAPPED = "::ffff:0:0/96" |
| 90 | + |
| 91 | +#: Documentation and example network |
| 92 | +#: (`RFC 3849 <https://tools.ietf.org/html/rfc3849>`_) |
| 93 | +DOCUMENTATION_NETWORK = "2001::db8::/32" |
| 94 | + |
| 95 | +#: 6to4 Address block |
| 96 | +#: (`RFC 3056 <https://tools.ietf.org/html/rfc3056>`_) |
| 97 | +IPV6_TO_IPV4_NETWORK = "2002::/16" |
| 98 | + |
| 99 | +#: Teredo addresses |
| 100 | +#: (`RFC 4380 <https://tools.ietf.org/html/rfc4380>`_) |
| 101 | +TEREDO_NETWORK = "2001::/32" |
| 102 | + |
| 103 | +#: Private network |
| 104 | +#: (`RFC 4193 <https://tools.ietf.org/html/rfc4193>`_) |
| 105 | +PRIVATE_NETWORK = "fd00::/8" |
| 106 | + |
| 107 | +#: Link-Local unicast networks (not globally routable) |
| 108 | +#: (`RFC 4291 <https://tools.ietf.org/html/rfc4291>`_) |
| 109 | +LINK_LOCAL = "fe80::/10" |
| 110 | + |
| 111 | +#: Multicast reserved block |
| 112 | +#: (`RFC 5771 <https://tools.ietf.org/html/rfc5771>`_) |
| 113 | +MULTICAST = "ff00::/8" |
| 114 | + |
| 115 | +#: Interface-Local multicast |
| 116 | +MULTICAST_LOOPBACK = "ff01::/16" |
| 117 | + |
| 118 | +#: Link-Local multicast |
| 119 | +MULTICAST_LOCAL = "ff02::/16" |
| 120 | + |
| 121 | +#: Site-Local multicast |
| 122 | +MULTICAST_SITE = "ff05::/16" |
| 123 | + |
| 124 | +#: Organization-Local multicast |
| 125 | +MULTICAST_SITE = "ff08::/16" |
| 126 | + |
| 127 | +#: Organization-Local multicast |
| 128 | +MULTICAST_GLOBAL = "ff0e::/16" |
| 129 | + |
| 130 | +#: All nodes on the local segment |
| 131 | +MULTICAST_LOCAL_NODES = "ff02::1" |
| 132 | + |
| 133 | +#: All routers on the local segment |
| 134 | +MULTICAST_LOCAL_ROUTERS = "ff02::2" |
| 135 | + |
| 136 | +#: All DHCP servers and relay agents on the local segment |
| 137 | +MULTICAST_LOCAL_DHCP = "ff02::1:2" |
| 138 | + |
| 139 | +#: All DHCP servers and relay agents on the local site |
| 140 | +MULTICAST_SITE_DHCP = "ff05::1:3" |
| 141 | + |
56 | 142 |
|
57 | 143 | def validate_ip(s): |
58 | 144 | """Validate a hexidecimal IPv6 ip address. |
|
0 commit comments