[SUB-ISSUE] Implement LAN Discovery & Connectivity using Iroh
📝 Description
Currently, our local network implementation in src/network/lan.rs is unreliable. This sub-issue focuses on replacing the custom logic with Iroh's native local network discovery and direct connection capabilities.
💡 Motivation
Peers on the same local network (e.g., same Wi-Fi or office network) should connect directly to each other without traversing the public internet or using relay nodes.
Who benefits: All users. This will drastically reduce latency, save bandwidth, and make local testing/development much smoother.
⚙️ Technical Details
How this should be implemented:
- Refactor/Replace: Update or replace the logic in
src/network/lan.rs and ensure it integrates cleanly with src/network/mod.rs.
- Iroh API: Utilize Iroh's
Endpoint or Node builder to enable local discovery (Iroh handles local network discovery automatically when configured correctly).
- Async Compatibility: Ensure the new implementation is fully
async/await compatible, aligning with Iroh's architecture.
- Testing: The implementation can and should be tested using the undertow-client repository. The goal is to run two instances on the same local network and verify they discover and connect to each other automatically without manual IP configuration.
🔄 Alternatives Considered
- Fixing the current custom UDP/mDNS implementation: Rejected. It has proven to be fragile, and maintaining a custom NAT/LAN stack is not the core focus of this project.
- Using a different library (e.g.,
libp2p): Since the parent issue decided on iroh for the whole project due to its superior Rust ergonomics and simplicity, we should stick to iroh for consistency.
📎 Additional Context
✅ Acceptance Criteria
[SUB-ISSUE] Implement LAN Discovery & Connectivity using Iroh
📝 Description
Currently, our local network implementation in
src/network/lan.rsis unreliable. This sub-issue focuses on replacing the custom logic with Iroh's native local network discovery and direct connection capabilities.💡 Motivation
Peers on the same local network (e.g., same Wi-Fi or office network) should connect directly to each other without traversing the public internet or using relay nodes.
Who benefits: All users. This will drastically reduce latency, save bandwidth, and make local testing/development much smoother.
⚙️ Technical Details
How this should be implemented:
src/network/lan.rsand ensure it integrates cleanly withsrc/network/mod.rs.EndpointorNodebuilder to enable local discovery (Iroh handles local network discovery automatically when configured correctly).async/awaitcompatible, aligning with Iroh's architecture.🔄 Alternatives Considered
libp2p): Since the parent issue decided onirohfor the whole project due to its superior Rust ergonomics and simplicity, we should stick toirohfor consistency.📎 Additional Context
✅ Acceptance Criteria
src/network/lan.rssuccessfully uses Iroh for local peer discovery.undertow-clientinstances on the same LAN connect automatically.