Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /snap/lxd/29351/lib/python3/dist-packages/ceph/deployment/ |
Upload File : |
import ipaddress def unwrap_ipv6(address): # type: (str) -> str if address.startswith('[') and address.endswith(']'): return address[1:-1] return address def wrap_ipv6(address): # type: (str) -> str # We cannot assume it's already wrapped or even an IPv6 address if # it's already wrapped it'll not pass (like if it's a hostname) and trigger # the ValueError try: if ipaddress.ip_address(address).version == 6: return f"[{address}]" except ValueError: pass return address def is_ipv6(address): # type: (str) -> bool address = unwrap_ipv6(address) try: return ipaddress.ip_address(address).version == 6 except ValueError: return False