Skip to content

[FEAT] Implement LAN Discovery & Connectivity using Iroh #21

Description

@daniil-verba

[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:

  1. Refactor/Replace: Update or replace the logic in src/network/lan.rs and ensure it integrates cleanly with src/network/mod.rs.
  2. Iroh API: Utilize Iroh's Endpoint or Node builder to enable local discovery (Iroh handles local network discovery automatically when configured correctly).
  3. Async Compatibility: Ensure the new implementation is fully async/await compatible, aligning with Iroh's architecture.
  4. 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

  • src/network/lan.rs successfully uses Iroh for local peer discovery.
  • Two undertow-client instances on the same LAN connect automatically.
  • No regressions in the existing public API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions