mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
cherry pick 7a1198c8c6/libp2p/utils/address_validation.py
This commit is contained in:
@ -71,16 +71,22 @@ def get_available_interfaces(port: int, protocol: str = "tcp") -> list[Multiaddr
|
|||||||
if seen_v4 and "127.0.0.1" not in seen_v4:
|
if seen_v4 and "127.0.0.1" not in seen_v4:
|
||||||
addrs.append(Multiaddr(f"/ip4/127.0.0.1/{protocol}/{port}"))
|
addrs.append(Multiaddr(f"/ip4/127.0.0.1/{protocol}/{port}"))
|
||||||
|
|
||||||
seen_v6: set[str] = set()
|
# TODO: IPv6 support temporarily disabled due to libp2p handshake issues
|
||||||
for ip in _safe_get_network_addrs(6):
|
# IPv6 connections fail during protocol negotiation (SecurityUpgradeFailure)
|
||||||
seen_v6.add(ip)
|
# Re-enable IPv6 support once the following issues are resolved:
|
||||||
addrs.append(Multiaddr(f"/ip6/{ip}/{protocol}/{port}"))
|
# - libp2p security handshake over IPv6
|
||||||
|
# - multiselect protocol over IPv6
|
||||||
# IPv6 enumeration (optional: only include if we have at least one global or
|
# - connection establishment over IPv6
|
||||||
# loopback)
|
#
|
||||||
# Optionally ensure IPv6 loopback when any IPv6 present but loopback missing
|
# seen_v6: set[str] = set()
|
||||||
if seen_v6 and "::1" not in seen_v6:
|
# for ip in _safe_get_network_addrs(6):
|
||||||
addrs.append(Multiaddr(f"/ip6/::1/{protocol}/{port}"))
|
# seen_v6.add(ip)
|
||||||
|
# addrs.append(Multiaddr(f"/ip6/{ip}/{protocol}/{port}"))
|
||||||
|
#
|
||||||
|
# # Always include IPv6 loopback for testing purposes when IPv6 is available
|
||||||
|
# # This ensures IPv6 functionality can be tested even without global IPv6 addresses
|
||||||
|
# if "::1" not in seen_v6:
|
||||||
|
# addrs.append(Multiaddr(f"/ip6/::1/{protocol}/{port}"))
|
||||||
|
|
||||||
# Fallback if nothing discovered
|
# Fallback if nothing discovered
|
||||||
if not addrs:
|
if not addrs:
|
||||||
|
|||||||
Reference in New Issue
Block a user