Check if we can bind to IPv6 localhost.
()
| 22 | return False |
| 23 | |
| 24 | def can_bind_ipv6_localhost(): |
| 25 | """Check if we can bind to IPv6 localhost.""" |
| 26 | try: |
| 27 | sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) |
| 28 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) |
| 29 | # Try to bind to IPv6 localhost on port 0 (any available port) |
| 30 | sock.bind(("::1", 0)) |
| 31 | sock.close() |
| 32 | return True |
| 33 | except (socket.error, OSError, AttributeError): |
| 34 | return False |
| 35 | |
| 36 | def get_default_localhost(): |
| 37 | """Get the default localhost address. |
no test coverage detected
searching dependent graphs…