feat/606-enable-nat-traversal-via-hole-punching (#668)

* feat: base implementation of dcutr for hole-punching

* chore: removed circuit-relay imports from __init__

* feat: implemented dcutr protocol

* added test suite with mock setup

* Fix pre-commit hook issues in DCUtR implementation

* usages of CONNECT_TYPE and SYNC_TYPE have been replaced with HolePunch.Type.CONNECT and HolePunch.Type.SYNC

* added unit tests for dcutr and nat module and

* added multiaddr.get_peer_id() with proper DNS address handling and fixed method signature inconsistencies

* added assertions to verify DCUtR hole punch result in integration test

---------

Co-authored-by: Manu Sheel Gupta <manusheel.edu@gmail.com>
This commit is contained in:
Soham Bhoir
2025-08-08 06:30:16 +05:30
committed by GitHub
parent 9ed44f5fa3
commit cb11f076c8
14 changed files with 2099 additions and 1 deletions

View File

@ -5,6 +5,16 @@ This package implements the Circuit Relay v2 protocol as specified in:
https://github.com/libp2p/specs/blob/master/relay/circuit-v2.md
"""
from .dcutr import (
DCUtRProtocol,
)
from .dcutr import PROTOCOL_ID as DCUTR_PROTOCOL_ID
from .nat import (
ReachabilityChecker,
is_private_ip,
)
from .discovery import (
RelayDiscovery,
)
@ -29,4 +39,8 @@ __all__ = [
"RelayResourceManager",
"CircuitV2Transport",
"RelayDiscovery",
"DCUtRProtocol",
"DCUTR_PROTOCOL_ID",
"ReachabilityChecker",
"is_private_ip",
]