nntp_proxy/lib.rs
1//! # NNTP Proxy Library
2//!
3//! A high-performance NNTP proxy server implementation with two operating modes:
4//! 1:1 mode (one backend per client) and per-command routing mode.
5//!
6//! ## Architecture
7//!
8//! The proxy is organized into several modules for clean separation of concerns:
9//!
10//! - **auth**: Authentication handling for both client and backend connections
11//! - **command**: NNTP command parsing and classification
12//! - **config**: Configuration loading and management
13//! - **pool**: Connection and buffer pooling for high performance
14//! - **protocol**: NNTP protocol constants and response parsing
15//! - **proxy**: Main proxy orchestration (NntpProxy struct)
16//! - **router**: Backend selection and load balancing
17//! - **types**: Core type definitions (ClientId, RequestId, BackendId)
18//!
19//! ## Design Philosophy
20//!
21//! This proxy operates in **stateless mode**, rejecting commands that require
22//! maintaining session state (like GROUP, NEXT, LAST). This design enables:
23//!
24//! - Simpler architecture with clear separation of concerns
25//! - Per-command routing mode where each command can use a different backend
26//! - Easy testing and maintenance of individual components
27//!
28//! ## Operating Modes
29//!
30//! - **1:1 mode**: Traditional mode where each client gets a dedicated backend connection
31//! - **Per-command routing mode**: Each command is routed to a backend (round-robin),
32//! but commands are still processed serially (NNTP is synchronous)
33
34// Module declarations
35mod auth;
36pub mod connection_error;
37pub mod network;
38pub mod protocol;
39mod proxy;
40pub mod stream;
41mod streaming;
42
43// Public modules for integration tests
44pub mod cache;
45pub mod command;
46pub mod config;
47pub mod constants;
48pub mod health;
49pub mod pool;
50pub mod router;
51pub mod session;
52pub mod tls;
53pub mod types;
54
55// Public exports
56pub use config::{CacheConfig, Config, ServerConfig, create_default_config, load_config};
57pub use network::SocketOptimizer;
58pub use proxy::NntpProxy;