1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Router federation for CLASP
//!
//! This crate enables CLASP routers to connect to each other and share
//! state across network boundaries. Federation links appear as normal
//! client sessions, using the standard CLASP protocol for communication.
//!
//! # Architecture
//!
//! Federation works by:
//! 1. Each router declares its owned **namespace patterns** (e.g., `/site-a/**`)
//! 2. Routers connect to each other and exchange namespace declarations
//! 3. Messages matching a peer's namespace are forwarded via the federation link
//! 4. Loop prevention uses an `origin` field -- messages are never forwarded
//! back to the router they came from
//!
//! # Modes
//!
//! - **Hub**: Central router that accepts leaf connections (star topology)
//! - **Leaf**: Edge router that connects to a single hub
//! - **Mesh**: Peer-to-peer connections between multiple routers
//!
//! # Example
//!
//! ```no_run
//! use clasp_federation::{FederationManager, FederationConfig, FederationMode};
//!
//! # async fn example() {
//! let config = FederationConfig {
//! mode: FederationMode::Leaf {
//! hub_endpoint: "wss://hub.example.com:7330".to_string(),
//! },
//! router_id: "site-a".to_string(),
//! owned_namespaces: vec!["/site-a/**".to_string()],
//! ..Default::default()
//! };
//!
//! let manager = FederationManager::new(config);
//! // Create links for each peer connection...
//! # }
//! ```
pub use ;
pub use ;
pub use ;
pub use FederationManager;
pub use NamespaceManager;