Commit Graph
2 Commits
Author SHA1 Message Date
TZGyn 15a6658d1c Add "share status" command and a relay-piped fallback for cross-network peers
status: swarm.Client.Status()/RoomStatus/FileStatus report per-room peer
count and per-file chunk progress; daemon gets a "status" control action;
CLI gets "share status" to display it.

Relay fallback: peers advertising a LAN-only address can't be dialed
directly by peers on a different network. connectToPeer now races a
direct dial against a relay-piped connection (both sides derive the same
pairing key from their two IDs, independent of who arrives first) and
uses whichever succeeds. The relay grows a second, on-demand path
alongside room membership: a "pipe" request pairs two connections on a
key and forwards raw bytes between them from then on, same as the
original relay's behavior before the rendezvous-only redesign, just now
triggered per-pair only when direct connection fails.
2026-07-20 12:27:27 +08:00
TZGyn 26cef8ee12 Turn the client into a background daemon; add per-chunk hash verification
Daemon (src/daemon): a Unix-socket control server holds every room this
machine is participating in. "share send"/"share <code>" resolve paths to
absolute, ask the daemon to join (auto-starting it if needed), and exit
immediately instead of blocking. "share stop" leaves every room and shuts
the daemon down; a stale socket from a crashed daemon self-heals on next
start.

swarm.Client is now a Start/Wait/Stop handle instead of a single blocking
Run, so the daemon can hold many rooms concurrently.

Also added per-chunk sha256 verification: the original seeder publishes a
hash for every chunk alongside the whole-file hash, and each chunk is
checked against it the moment it arrives — before it's written to disk or
reshared to other peers — rather than only catching corruption after the
whole file is assembled.
2026-07-20 11:45:33 +08:00