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
53
54
55
//! P2P communication abstraction system
//!
//! This crate provides a generic abstraction layer for peer-to-peer networking,
//! supporting multiple underlying implementations through a trait-based design.
//!
//! # Features
//!
//! * **Generic P2P traits** - [`P2PSystem`], [`P2PConnection`], and [`P2PNodeId`] traits
//! provide implementation-agnostic interfaces for P2P communication
//! * **Network simulator** - A complete P2P network simulator with realistic network
//! conditions including latency, packet loss, and network partitions (enabled with
//! the `simulator` feature, on by default)
//! * **Type-safe error handling** - Comprehensive error types via [`P2PError`]
//!
//! # Getting Started
//!
//! ```rust,no_run
//! # #[cfg(feature = "simulator")]
//! # async fn example() {
//! use switchy_p2p::simulator::SimulatorP2P;
//!
//! // Create a new P2P node with deterministic ID for testing
//! let node = SimulatorP2P::with_seed("alice");
//! let node_id = node.local_node_id().clone();
//!
//! println!("Node ID: {}", node_id.fmt_short());
//! # }
//! ```
//!
//! # Main Entry Points
//!
//! * [`traits`] - Core P2P traits for implementing or using P2P systems
//! * [`types`] - Error types and type aliases
//! * [`simulator`] - Network simulator implementation (requires `simulator` feature)
//!
//! [`P2PSystem`]: traits::P2PSystem
//! [`P2PConnection`]: traits::P2PConnection
//! [`P2PNodeId`]: traits::P2PNodeId
//! [`P2PError`]: types::P2PError
// Phase 2.1: First module added
// Phase 3.1: Core types and traits
// Modules will be added in later phases:
// - Phase 4.1: (extend types with thiserror)
// - Phase 5.1: mod router;