aetheris_protocol/lib.rs
1//! Core protocol definitions and communication contracts for the Aetheris Engine.
2//!
3//! **Phase:** All Phases - Stable Core
4//! **Constraint:** Minimal dependency footprint.
5//! **Purpose:** Defines the Trait Facade (`GameTransport`, `WorldState`, Encoder) that isolates
6//! the engine logic from concrete implementations.
7
8#![warn(clippy::all, clippy::pedantic)]
9
10pub mod error;
11pub mod events;
12pub mod reassembler;
13pub mod traits;
14
15/// The current version of the Aetheris Protocol.
16pub const VERSION: &str = env!("CARGO_PKG_VERSION");
17pub mod types;
18
19pub use reassembler::Reassembler;
20
21/// Maximum safe payload size for UDP datagrams to avoid fragmentation.
22pub const MAX_SAFE_PAYLOAD_SIZE: usize = 1200;
23
24/// Maximum number of fragments allowed for a single message.
25/// 1024 * 1136 bytes ~= 1.1 MiB.
26pub const MAX_TOTAL_FRAGMENTS: u16 = 1024;
27
28/// Estimated overhead in bytes for a `WireEvent::Fragment` envelope using `rmp-serde`.
29/// This includes the enum tag, `FragmentedEvent` fields, and `Vec<u8>` length prefix.
30pub const FRAGMENT_OVERHEAD: usize = 64;
31
32/// The maximum bytes of game payload that can fit into a single MTU-safe fragment.
33pub const MAX_FRAGMENT_PAYLOAD_SIZE: usize = MAX_SAFE_PAYLOAD_SIZE - FRAGMENT_OVERHEAD;
34
35#[cfg(feature = "grpc")]
36/// gRPC Auth services and types generated from `auth.proto`.
37#[allow(clippy::all, clippy::pedantic)]
38pub mod auth {
39 pub mod v1 {
40 tonic::include_proto!("aetheris.auth.v1");
41 }
42}
43
44#[cfg(feature = "grpc")]
45/// gRPC Matchmaking services and types generated from `matchmaking.proto`.
46#[allow(clippy::all, clippy::pedantic)]
47pub mod matchmaking {
48 pub mod v1 {
49 tonic::include_proto!("aetheris.matchmaking.v1");
50 }
51}
52
53#[cfg(feature = "grpc")]
54/// gRPC Telemetry service and types generated from `telemetry.proto`.
55/// This module is the out-of-band diagnostic channel — independent of WebTransport.
56#[allow(clippy::all, clippy::pedantic)]
57pub mod telemetry {
58 pub mod v1 {
59 tonic::include_proto!("aetheris.telemetry.v1");
60 }
61}
62
63#[cfg(any(test, feature = "test-utils"))]
64pub mod test_doubles;
65
66#[cfg(test)]
67mod tests {
68 #[test]
69 fn test_protocol_foundation() {
70 // Basic assertion to satisfy nextest's requirement for at least one test
71 let synchronized = true;
72 assert!(synchronized);
73 }
74}