network_protocol/protocol/
mod.rs

1//! # Network Protocol Module
2//!
3//! This file is part of the Network Protocol project.
4//!
5//! It provides the main entry point for the protocol layer,
6//! including the core components, transport mechanisms,
7//! and utility functions.
8//!
9//! The protocol is designed to be modular, high-performance,
10//! and suitable for local, remote, and cluster communication.
11//!
12//! The main components include:
13//! - Core: packet handling, codec, error management
14//! - Transport: network communication, remote operations
15//! - Protocol: message routing, handshake logic
16//! - Service: client and daemon abstractions
17//! - Utils: cryptography, compression, time management
18//!
19//! The protocol layer is built with a focus on performance,
20//! scalability, and ease of integration with other systems.
21//!
22//! ## Components
23//! - `core`: Contains the core packet structure and codec for serialization/deserialization.
24//! - `transport`: Implements the transport layer for network communication, including remote and local operations.
25//! - `protocol`: Handles message routing and protocol-specific logic.
26//! - `service`: Provides abstractions for client and daemon operations.
27//! - `utils`: Contains utility functions for cryptography, compression, and time management.
28//!
29//! This module is essential for processing protocol packets in a networked environment,
30//! ensuring correct parsing and serialization.
31//!
32//! It is designed to be efficient, minimal, and easy to integrate into the protocol layer.
33//! # Protocol Layer
34//!
35//! Core protocol implementation including message handling, handshakes, and keepalive.
36//!
37//! This module implements the application-level protocol on top of the transport layer.
38//! It handles secure session establishment, message routing, and connection lifecycle.
39//!
40//! ## Components
41//! - **Handshake**: Secure session establishment with nonce and timestamp validation
42//! - **Message**: Application-level message types and serialization
43//! - **Dispatcher**: Message routing and handler registration
44//! - **Heartbeat**: Connection liveness and idle detection
45//! - **Keepalive**: Ping/pong mechanism for timeout prevention
46//!
47//! ## Security Features
48//! - Per-session nonce tracking (prevents replay attacks)
49//! - Timestamp validation (5-second window)
50//! - AEAD encryption for all messages
51//! - Session-specific encryption keys
52
53pub mod dispatcher;
54pub mod handshake;
55pub mod heartbeat;
56pub mod keepalive;
57pub mod message;
58
59#[cfg(test)]
60mod tests;