ant_core/
lib.rs

1//! # P2P Foundation
2//! 
3//! A next-generation peer-to-peer networking foundation built in Rust.
4//! 
5//! ## Features
6//! 
7//! - QUIC-based transport for modern networking
8//! - IPv6-first with comprehensive tunneling support
9//! - Kademlia DHT for distributed routing
10//! - Built-in MCP server for AI capabilities
11//! - Minimal dependencies and small footprint
12//! 
13//! ## Example
14//! 
15//! ```rust,no_run
16//! use p2p_foundation::{P2PNode, NodeConfig};
17//! 
18//! #[tokio::main]
19//! async fn main() -> anyhow::Result<()> {
20//!     let node = P2PNode::builder()
21//!         .listen_on("/ip6/::/tcp/9000")
22//!         .with_mcp_server()
23//!         .build()
24//!         .await?;
25//!     
26//!     node.run().await?;
27//!     Ok(())
28//! }
29//! ```
30
31#![warn(missing_docs)]
32#![warn(rust_2018_idioms)]
33
34/// Network core functionality
35pub mod network;
36
37/// Distributed Hash Table implementation
38pub mod dht;
39
40/// Transport layer (QUIC, TCP)
41pub mod transport;
42
43/// IPv6/IPv4 tunneling protocols
44pub mod tunneling;
45
46/// Model Context Protocol server
47pub mod mcp;
48
49/// Security and cryptography
50pub mod security;
51
52/// User identity and privacy system
53pub mod identity;
54
55/// Utility functions and types
56pub mod utils;
57
58/// Production hardening features
59pub mod production;
60
61/// Bootstrap cache for decentralized peer discovery
62pub mod bootstrap;
63
64/// Error types
65pub mod error;
66
67// Re-export main types
68pub use network::{P2PNode, NodeConfig, NodeBuilder, P2PEvent};
69pub use dht::{Key, Record};
70pub use mcp::{MCPServer, Tool, MCPService};
71pub use production::{ProductionConfig, ResourceManager, ResourceMetrics};
72pub use bootstrap::{BootstrapManager, BootstrapCache, ContactEntry, CacheConfig};
73pub use error::{P2PError, Result};
74
75// Placeholder types (will be replaced with actual libp2p types)
76/// Peer identifier used throughout the P2P Foundation
77/// 
78/// Currently implemented as a String for simplicity, but will be replaced
79/// with proper libp2p PeerId type in future versions.
80pub type PeerId = String;
81
82/// Multiaddress used for network addressing
83/// 
84/// Currently implemented as a String for simplicity, but will be replaced  
85/// with proper libp2p Multiaddr type in future versions.
86pub type Multiaddr = String;
87
88/// P2P Foundation version
89pub const VERSION: &str = env!("CARGO_PKG_VERSION");
90
91#[cfg(test)]
92mod tests {
93    use super::*;
94    
95    #[test]
96    fn test_version() {
97        assert!(!VERSION.is_empty());
98    }
99}