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
//! # gradatum-warden
//!
//! Network layer L0 for Gradatum: CIDR IP filtering, per-IP rate limiting, and loopback bypass.
//!
//! ## Public components
//!
//! - [`WardenLayer`]: tower `Layer` implementation to mount on an Axum router.
//! - [`WardenConfig`]: complete warden configuration (TOML/JSON serializable).
//! - [`WardenError`]: construction error (invalid configuration).
//! - [`WardenDecision`]: per-request warden decision (observable in tests).
//!
//! ## Loopback bypass guarantee
//!
//! Unlike `tower_governor` (where `error_handler` terminated the chain with `Body::empty()`),
//! the warden always calls `inner.call(req)` for bypass/allow requests.
//! The returned body is the real handler body — never a synthetic empty body.
//!
//! ## Example
//!
//! ```rust,ignore
//! use gradatum_warden::{WardenConfig, WardenLayer};
//!
//! let config = WardenConfig {
//! enabled: true,
//! rate_limit_per_minute: 60,
//! rate_limit_burst: 10,
//! bypass_loopback: true,
//! ..WardenConfig::default()
//! };
//! let warden = WardenLayer::new(config).expect("config warden valide");
//! // app.layer(warden)
//! ```
pub use WardenConfig;
pub use ;
pub use WardenLayer;