Make joining a network idempotent and shut down cleanly on every path
Running `tsunagi up` twice with the same arguments failed with "network ... is already active", and then dropped the iroh endpoint without closing it. A configured network is activated automatically at startup, so the second run found it already up. `join_network` is declarative — "be a member of this network" — so joining one that is already active now succeeds and changes nothing. `activate_network` stays strict for callers that specifically want to know whether an inactive network was started. The CLI now closes the agent on the error path too, and handles SIGTERM as well as Ctrl-C, so a service manager stopping the agent gets the same clean shutdown an interactive user does. Also documents the two lookups people conflate: resolving one endpoint's address is iroh's public pkarr/DNS service and works today, which is why `--peer <endpoint-id>` needs no address; finding who is in a network is this project's `NetworkDiscovery` and is still static bootstrap only. Notes in the README and the threat model that `n0` and `direct` publish this endpoint's addresses to a public third-party service. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,12 @@ Read this before relying on anything here. The protocol is in
|
||||
- **Weak secrets.** This targets high-entropy secrets. There is no PAKE, so a
|
||||
short human passphrase can be guessed offline by anyone who can reach the
|
||||
handshake. Use `NetworkSecret::generate()`.
|
||||
- **Public address publication.** With `TransportPolicy::N0Defaults` or
|
||||
`DirectOnly`, iroh publishes a signed record of this endpoint's addresses,
|
||||
keyed by its endpoint id, to Number 0's public pkarr/DNS service, and
|
||||
resolves peers through it. The network secret is never published and
|
||||
membership cannot be inferred from a single record, but the endpoint's
|
||||
existence and its addresses become public. `LocalOnly` publishes nothing.
|
||||
- **Addresses and metadata are observable.** Anyone able to watch the network
|
||||
sees addresses, timing and volume. Discovery backends see the
|
||||
`discovery_key` and the addresses published under it, which is enough to map
|
||||
|
||||
Reference in New Issue
Block a user