Extract IPv4 address embedded in 6to4 address. Passed address must be a 6to4 address. None is returned on error.
(addr)
| 388 | |
| 389 | |
| 390 | def in6_6to4ExtractAddr(addr): |
| 391 | # type: (str) -> Optional[str] |
| 392 | """ |
| 393 | Extract IPv4 address embedded in 6to4 address. Passed address must be |
| 394 | a 6to4 address. None is returned on error. |
| 395 | """ |
| 396 | try: |
| 397 | baddr = inet_pton(socket.AF_INET6, addr) |
| 398 | except Exception: |
| 399 | return None |
| 400 | if baddr[:2] != b" \x02": |
| 401 | return None |
| 402 | return inet_ntop(socket.AF_INET, baddr[2:6]) |
| 403 | |
| 404 | |
| 405 | def in6_getLocalUniquePrefix(): |