*: improve NAT hole punching#4516
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR switches Charon’s NAT traversal strategy from a custom “force direct dial” loop to libp2p’s built-in DCUtR hole punching, aiming to more reliably upgrade relay connections to direct connections.
Changes:
- Enabled libp2p hole punching via
libp2p.EnableHolePunching()when constructing the host. - Removed the
ForceDirectConnectionslifecycle hook and its lifecycle ordering/wiring. - Updated lifecycle
stringeroutputs to reflect the removed start hook.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
p2p/p2p.go |
Enables libp2p hole punching and removes custom forced-direct connection logic; updates an inline comment in QUIC upgrade path. |
app/app.go |
Stops registering the removed ForceDirectConnections lifecycle start hook. |
app/lifecycle/order.go |
Removes StartForceDirectConns from the global start ordering. |
app/lifecycle/orderstart_string.go |
Regenerated/updated OrderStart stringer mapping after removing StartForceDirectConns. |
app/lifecycle/orderstop_string.go |
Updates OrderStop stringer implementation (consistent with regenerated output). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4516 +/- ##
==========================================
+ Coverage 57.05% 57.07% +0.02%
==========================================
Files 245 245
Lines 32964 32934 -30
==========================================
- Hits 18806 18797 -9
+ Misses 11782 11759 -23
- Partials 2376 2378 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|



ForceDirectConnectionsdoes require the peers to attempt this at the exact same time, which occurs only when the stars align...libp2p.EnableHolePunching()should attempt direct connection in much more sophisticated and native way.It is yet to be tested on hoodi.
category: feature
ticket: #4233