Internal function used by parseAddress() to parse IPv6 address with ':'. >>> print(_parseAddressIPv6('::')) 0 >>> print(_parseAddressIPv6('::1')) 1 >>> print(_parseAddressIPv6('0:0:0:0:0:0:0:1')) 1 >>> print(_parseAddressIPv6('0:0:0::0:0:1')) 1 >>> print(_pa
(ipstr)
| 1218 | |
| 1219 | |
| 1220 | def _parseAddressIPv6(ipstr): |
| 1221 | """ |
| 1222 | Internal function used by parseAddress() to parse IPv6 address with ':'. |
| 1223 | |
| 1224 | >>> print(_parseAddressIPv6('::')) |
| 1225 | 0 |
| 1226 | >>> print(_parseAddressIPv6('::1')) |
| 1227 | 1 |
| 1228 | >>> print(_parseAddressIPv6('0:0:0:0:0:0:0:1')) |
| 1229 | 1 |
| 1230 | >>> print(_parseAddressIPv6('0:0:0::0:0:1')) |
| 1231 | 1 |
| 1232 | >>> print(_parseAddressIPv6('0:0:0:0:0:0:0:0')) |
| 1233 | 0 |
| 1234 | >>> print(_parseAddressIPv6('0:0:0::0:0:0')) |
| 1235 | 0 |
| 1236 | |
| 1237 | >>> print(_parseAddressIPv6('FEDC:BA98:7654:3210:FEDC:BA98:7654:3210')) |
| 1238 | 338770000845734292534325025077361652240 |
| 1239 | >>> print(_parseAddressIPv6('1080:0000:0000:0000:0008:0800:200C:417A')) |
| 1240 | 21932261930451111902915077091070067066 |
| 1241 | >>> print(_parseAddressIPv6('1080:0:0:0:8:800:200C:417A')) |
| 1242 | 21932261930451111902915077091070067066 |
| 1243 | >>> print(_parseAddressIPv6('1080:0::8:800:200C:417A')) |
| 1244 | 21932261930451111902915077091070067066 |
| 1245 | >>> print(_parseAddressIPv6('1080::8:800:200C:417A')) |
| 1246 | 21932261930451111902915077091070067066 |
| 1247 | >>> print(_parseAddressIPv6('FF01:0:0:0:0:0:0:43')) |
| 1248 | 338958331222012082418099330867817087043 |
| 1249 | >>> print(_parseAddressIPv6('FF01:0:0::0:0:43')) |
| 1250 | 338958331222012082418099330867817087043 |
| 1251 | >>> print(_parseAddressIPv6('FF01::43')) |
| 1252 | 338958331222012082418099330867817087043 |
| 1253 | >>> print(_parseAddressIPv6('0:0:0:0:0:0:13.1.68.3')) |
| 1254 | 218186755 |
| 1255 | >>> print(_parseAddressIPv6('::13.1.68.3')) |
| 1256 | 218186755 |
| 1257 | >>> print(_parseAddressIPv6('0:0:0:0:0:FFFF:129.144.52.38')) |
| 1258 | 281472855454758 |
| 1259 | >>> print(_parseAddressIPv6('::FFFF:129.144.52.38')) |
| 1260 | 281472855454758 |
| 1261 | >>> print(_parseAddressIPv6('1080:0:0:0:8:800:200C:417A')) |
| 1262 | 21932261930451111902915077091070067066 |
| 1263 | >>> print(_parseAddressIPv6('1080::8:800:200C:417A')) |
| 1264 | 21932261930451111902915077091070067066 |
| 1265 | >>> print(_parseAddressIPv6('::1:2:3:4:5:6')) |
| 1266 | 1208962713947218704138246 |
| 1267 | >>> print(_parseAddressIPv6('1:2:3:4:5:6::')) |
| 1268 | 5192455318486707404433266432802816 |
| 1269 | """ |
| 1270 | |
| 1271 | # Split string into a list, example: |
| 1272 | # '1080:200C::417A' => ['1080', '200C', '417A'] and fill_pos=2 |
| 1273 | # and fill_pos is the position of '::' in the list |
| 1274 | items = [] |
| 1275 | index = 0 |
| 1276 | fill_pos = None |
| 1277 | while index < len(ipstr): |
no test coverage detected