Skip to content

feat: add DCUtR hole-punch interop test app - #281

Open
adust09 wants to merge 2 commits into
mainfrom
feat/131-dcutr-hole-punch-interop-20260904-1220
Open

feat: add DCUtR hole-punch interop test app#281
adust09 wants to merge 2 commits into
mainfrom
feat/131-dcutr-hole-punch-interop-20260904-1220

Conversation

@adust09

@adust09 adust09 commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • TCP hole-punch dials bind SO_REUSEADDR/SO_REUSEPORT to the listen port so the NAT mapping matches the address advertised in DCUtR CONNECT.
  • Relay connections used for Identify originate from that same listen port; DCUtR CONNECT scopes the observed address to the active relay and retains non-relayed listen candidates.
  • libp2p-hole-punch implements the current unified-testing role, environment, Redis coordination, routing, timeout, and nested latency YAML contracts.
  • The local self-test now reproduces the upstream WAN + two NAT routers + isolated peer LANs topology.
  • Failed/cancelled parallel dials close sockets, upgraded losing connections, and resource reservations safely.

Why

Refs #131. DCUtR was only exercised on loopback. The upstream hole-punch harness puts both peers behind separate SNAT routers, so simultaneous opens must reuse the source port whose mapped address was learned through the relay.

The unified-testing images.yaml PR remains a follow-up because its GitHub source builder must pin a merged commit from this repository.

Test plan

  • Full Haskell test suite: 1,228 examples, 0 failures
  • make -C interop hole-punch-self-test against two local NAT routers
  • Latest libp2p/unified-testing harness (4ade567b), Linux routers + Rust relay:
    • rust-v0.56 dialer × haskell-v0.1 listener
    • haskell-v0.1 dialer × rust-v0.56 listener
    • haskell-v0.1 dialer × haskell-v0.1 listener
  • unified-testing extracts latency.handshake_plus_one_rtt, ping_rtt, and unit
  • After merge: PR to libp2p/unified-testing adding haskell-v0.1 to hole-punch/images.yaml

Hole punching against a real NAT needs the outgoing SYN to leave from
the listen port and DCUtR CONNECT to advertise Identify observed
addresses (NAT mappings), not LAN listen addrs. The new
libp2p-hole-punch binary speaks the unified-testing hole-punch contract
so hs can join the upstream matrix after this lands.

Refs #131
Use the harness role, routing, address, timeout, and latency contracts so DCUtR runs through the real NAT topology. Keep simultaneous-open source ports aligned with observed relay mappings and make failed parallel dials exception-safe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant