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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! WiseGate Core - Reusable reverse proxy components
//!
//! This crate provides the core functionality for building reverse proxies with:
//! - Rate limiting with sliding window algorithm
//! - IP filtering and blocking
//! - HTTP method and URL pattern filtering
//! - Trusted proxy validation (RFC 7239 compliant)
//!
//! # Overview
//!
//! `wisegate-core` is designed to be framework-agnostic and can be integrated
//! into any Rust application. Configuration is provided via the [`ConfigProvider`]
//! trait, allowing flexible configuration from any source.
//!
//! # Quick start
//!
//! [`DefaultConfig`] pre-implements every configuration trait, so a minimal
//! setup needs no boilerplate. Mutate its public fields to customize behaviour:
//!
//! ```
//! use std::time::Duration;
//! use wisegate_core::{DefaultConfig, RateLimiter};
//!
//! let mut config = DefaultConfig::default();
//! config.rate_limit.max_requests = 200;
//! config.rate_limit.window_duration = Duration::from_secs(30);
//! config.blocked_methods = vec!["TRACE".into(), "CONNECT".into()];
//!
//! let _limiter = RateLimiter::new();
//! ```
//!
//! When you need finer control, implement the composable traits directly
//! ([`RateLimitingProvider`], [`ProxyProvider`], [`FilteringProvider`],
//! [`ConnectionProvider`], [`AuthenticationProvider`]). See [`types`] for
//! a worked example of bespoke implementations.
//!
//! # Wiring it into hyper
//!
//! [`request_handler::handle_request`] is async and expects a Tokio runtime —
//! call it from inside `#[tokio::main]` or any other Tokio executor. It takes
//! an `Arc<C: ConfigProvider>` so the same configuration can be cloned cheaply
//! across spawned tasks.
//!
//! # Modules
//!
//! - [`types`] - Core types and the [`ConfigProvider`] trait
//! - [`error`] - Error types and result aliases
//! - [`headers`] - HTTP header constants
//! - [`ip_filter`] - IP validation, extraction, and filtering
//! - [`rate_limiter`] - Rate limiting implementation
//! - [`request_handler`] - HTTP request processing and forwarding
// Re-export commonly used items at crate root
pub use ;
pub use DefaultConfig;
pub use WiseGateError;
pub use ;