Working library with real iroh connections, not an interface sketch: - persistent device identity in state.sqlite, stable across restarts - deterministic network space derived from name + secret via HKDF-SHA256, with frozen labels and unambiguous length-prefixed encoding - replaceable discovery returning unverified candidates only; static bootstrap, in-memory test backend and a composite - real iroh connections plus an explicit mutual membership proof: HMAC-SHA256 over a role-separated transcript bound to the TLS exporter, the network id and both endpoint identities - small versioned control protocol: handshake, announcement, ping/pong - multiple networks per agent with enforced isolation - automatic reconnect with bounded backoff and jitter - mandatory state vs disposable cache, with a real directory ownership lock - status snapshots, event stream and honest diagnostics 47 integration and unit tests cover the required scenarios offline on loopback. Snapshots, revocations and WireGuard are designed for and documented, not implemented. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
28 lines
980 B
Rust
28 lines
980 B
Rust
//! The control protocol: framing, messages and the network membership
|
|
//! handshake.
|
|
//!
|
|
//! Only control messages travel over iroh. User IP traffic is never tunnelled
|
|
//! through this protocol.
|
|
//!
|
|
//! Layering, outermost first:
|
|
//!
|
|
//! 1. iroh/QUIC connection with ALPN [`message::ALPN`] — endpoint
|
|
//! authentication, confidentiality and integrity.
|
|
//! 2. One bidirectional stream per session, carrying length-prefixed frames
|
|
//! ([`frame`]).
|
|
//! 3. The [`handshake`], which must complete before anything else is accepted.
|
|
//! 4. [`message::Envelope`]s carrying [`message::ControlMessage`]s, each
|
|
//! re-checked against the session's network id.
|
|
//!
|
|
//! Nothing here adds its own encryption on top of iroh.
|
|
|
|
pub mod frame;
|
|
pub mod handshake;
|
|
pub mod message;
|
|
|
|
pub use frame::{read_frame, write_frame};
|
|
pub use handshake::{HandshakeOutcome, Role};
|
|
pub use message::{
|
|
ALPN, Announcement, AuthProof, ControlMessage, Envelope, Hello, HelloAck, PROTOCOL_VERSION,
|
|
};
|