Skip to content

feat(contacts): direct peer-to-peer connections via connection strings#47

Open
chanderlud wants to merge 3 commits into
masterfrom
feature/direct-contacts
Open

feat(contacts): direct peer-to-peer connections via connection strings#47
chanderlud wants to merge 3 commits into
masterfrom
feature/direct-contacts

Conversation

@chanderlud

Copy link
Copy Markdown
Owner

Summary

Contacts can now be marked as "direct connections" with an Iroh endpoint address string. This lets peers connect directly without going through the relay server — useful for LAN setups or when both sides have public addresses.

What changed

  • Contact model — Contact gains is_direct and direct_connection_string fields, persisted through the profiles JSON backend
  • Session manager — when opening a session for a direct-contact, the manager parses the connection string into an EndpointAddr and calls endpoint.connect() directly instead of relaying through the discovery service
  • Networking settings — a new "Your Connection Strings" section displays the local endpoint's addresses (direct addresses + relay URL) that can be shared with other users
  • Contact forms — add-contact and edit-contact dialogs now show a Direct Connection toggle and a connection string text field

Design decisions

  • Uses serde_json to serialize EndpointAddr (Iroh's type already implements Serialize/Deserialize) — no custom encoding needed
  • The local endpoint address is stored in CoreState after bind and cleared on teardown to prevent stale info
  • Backward compatible — existing contacts without direct fields load with is_direct: false and direct_connection_string: null

Test plan

  • Rust unit and integration tests pass (53/53)
  • Dart unit tests pass with updated mocks for the new
    odeAddr() method
  • System tests should be run manually in WSL

Compound Engineering

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