Add file listing: share-dir flag, file_list_req/resp DataChannel messages

- proto: FileEntry, FileListResp types; MsgFileListReq/Resp msg types;
  CmdGetFileList + EvtFileList IPC types; Files field on IpcMessage
- mesh: ShareDir field + ScanShareDir(); on DataChannel open, auto-send
  MsgFileListReq to new peer; handle MsgFileListReq (scan + reply) and
  MsgFileListResp (emit EvtFileList to IPC subscribers)
- ipc: get_file_list command — own list returned immediately; remote peer
  list requested via DataChannel (response arrives as EvtFileList event)
- daemon: -share-dir flag wired to mesh.ShareDir
- test scripts: pass -share-dir /home/frejoh/Downloads/{alice,bob,charlie};
  test-network.sh verifies each peer's own file list via get_file_list
- FUTURE.md: document per-network share directories and multi-network design

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Fredrik Johansson
2026-06-21 19:07:11 +02:00
parent 1a5f416ee4
commit 8d3ca9d331
9 changed files with 160 additions and 20 deletions

View File

@@ -59,6 +59,15 @@ No DHT needed at small group scale (1050 nodes). Keep it simple:
- Public key = stable identity, not a mutable nickname
- No phone number, no central registry — closer to Signal's model than WASTE's original unregistered aliases
### Per-Network Share Directories
The current `-share-dir` flag is a single global directory. Eventually, each network should have its own independent share set:
- Alice shares `/home/alice/Downloads/work-files` on the "work" network
- Alice shares `/home/alice/Music` on the "friends" network
- Peers on "work" never see Alice's music, and vice versa
When multi-network support lands (see below), the `ShareDir` field on `networkCtx` replaces the current global `Mesh.ShareDir`. The IPC `get_file_list` and daemon `-share-dir` flag should move to be per-network configuration — either via a config file or via an IPC command `set_share_dir` scoped to a `network_id`.
### Multi-Network Support
A single client should be able to participate in multiple networks simultaneously (e.g. "work" and "friends") without leaking that both identities belong to the same person.