Jason Tudisco 69e4f13c22 Add internet peer discovery via pkarr relay rendezvous
Peers sharing the same sync_passphrase can now find each other
automatically over the internet without manual ticket exchange or
port forwarding. Uses n0's public pkarr relay servers as a
rendezvous point.

How it works:
- Derive 8 deterministic Ed25519 keypair "slots" from the passphrase
- Each peer claims a slot by publishing its EndpointId as a TXT record
- All peers scan all 8 slots every 15s to discover new peers
- Re-publish every 60s with 5min TTL to stay visible
- Discovered EndpointIds feed into the same peer channel as gossip

This runs alongside the existing gossip discovery (which still needs
bootstrap peers) and direct ticket-file connections (used by tests).

All 6 stress tests pass (102 assets, 63+ MB/s bidirectional).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:53:34 -06:00

61 lines
1.3 KiB
TOML

[package]
name = "can-sync"
version = "0.2.0"
edition = "2021"
description = "P2P sync agent for CAN service — full mirror replication via iroh"
[[bin]]
name = "can-sync"
path = "src/main.rs"
[[bin]]
name = "sync-test"
path = "tests/sync_test.rs"
[dependencies]
# P2P networking (iroh for transport + gossip for discovery — NO iroh-docs)
iroh = "0.96"
iroh-gossip = "0.96"
# Protobuf (same message types as CAN service sync API)
prost = "0.13"
# HTTP client for CAN service sync API
reqwest = { version = "0.12", features = ["json", "multipart", "blocking"] }
# Serialization
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.9"
# Crypto
blake3 = "1"
ed25519-dalek = "3.0.0-pre.1"
# Pkarr (internet rendezvous via relay servers — relay only, no DHT to avoid digest conflict)
pkarr = { version = "5", default-features = false, features = ["relays"] }
# DNS record parsing (used by pkarr)
simple-dns = "0.9"
# Async runtime
tokio = { version = "1", features = ["full"] }
# Logging
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# Stream utilities (needed for gossip event stream)
n0-future = "0.1"
# SSE client (for real-time events from CAN service)
tokio-stream = "0.1"
futures-util = "0.3"
# Utilities
anyhow = "1"
bytes = "1"
hex = "0.4"
serde_json = "1"
tempfile = "3"
rand = "0.9"