🚀 [FEAT] Replace custom NAT/LAN implementation with Iroh for reliable P2P connectivity
📌 Current Limitations
Our current custom NAT/LAN implementation (src/network/lan.rs & src/network/beacon_client.rs) has critical limitations:
- Fails to reliably establish connections with the Beacon node.
- Lacks support for IPv6 and modern NAT traversal techniques.
- Results in frequent connection timeouts in real-world network environments (e.g., behind strict firewalls).
🌟 Proposed Solution
Replace the custom implementation with Iroh — a battle-tested, production-ready P2P networking library.
Why Iroh?
- ✅ Built-in NAT traversal (UPnP, STUN, TURN, and relay fallbacks).
- ✅ Zero-config Local Area Network (LAN) discovery.
- ✅ Production-ready and actively maintained by the team behind
n0-computer.
🔧 Implementation Plan
-
Refactor custom NAT/LAN code:
- Rewrite/replace logic in
src/network/lan.rs
- Rewrite/replace logic in
src/network/beacon_client.rs
-
Integrate Iroh:
# Cargo.toml
[dependencies]
iroh = "0.21" # (or latest stable version)
-
Adapt the API:
- Map
undertow-protocol's peer discovery to Iroh's Node API.
- Implement connection fallbacks.
⚠️ Potential Challenges
- API Compatibility: Iroh is heavily
async/await based, while parts of our current network code are synchronous. We will need to refactor the core networking layer to be fully async.
- Dependency Size: Iroh adds some overhead to the binary size, but this is an acceptable trade-off for massive gains in reliability.
💡 How You Can Help
This is a great task for a first-time contributor! We need help with:
🙏 Why This Matters
This change will solve the #1 pain point of the project. With Iroh, undertow-protocol will finally work reliably in real-world networks, making it truly viable for decentralized applications. Let's build something that just works! 🚀
✅ Checklist Before Merging
💬 Discussion
What do you think about this approach?
- Should we fully replace the current implementation, or keep it as a fallback for now?
- We can break this down into smaller sub-issues to make it easier to tackle step-by-step!
🚀 [FEAT] Replace custom NAT/LAN implementation with Iroh for reliable P2P connectivity
📌 Current Limitations
Our current custom NAT/LAN implementation (
src/network/lan.rs&src/network/beacon_client.rs) has critical limitations:🌟 Proposed Solution
Replace the custom implementation with Iroh — a battle-tested, production-ready P2P networking library.
Why Iroh?
n0-computer.🔧 Implementation Plan
Refactor custom NAT/LAN code:
src/network/lan.rssrc/network/beacon_client.rsIntegrate Iroh:
Adapt the API:
undertow-protocol's peer discovery to Iroh'sNodeAPI.async/awaitbased, while parts of our current network code are synchronous. We will need to refactor the core networking layer to be fully async.💡 How You Can Help
This is a great task for a first-time contributor! We need help with:
src/network/mod.rs(and related files) to Iroh's API.README.mdwith the new connectivity guarantees and setup instructions.🙏 Why This Matters
This change will solve the #1 pain point of the project. With Iroh,
undertow-protocolwill finally work reliably in real-world networks, making it truly viable for decentralized applications. Let's build something that just works! 🚀✅ Checklist Before Merging
💬 Discussion
What do you think about this approach?