Skip to main content

wisegate/
lib.rs

1//! WiseGate - A wise guardian for your network gates
2//!
3//! An efficient, secure reverse proxy with built-in rate limiting and IP filtering.
4//!
5//! # Overview
6//!
7//! WiseGate is a high-performance reverse proxy written in Rust that provides:
8//! - Rate limiting with sliding window algorithm
9//! - IP filtering and blocking
10//! - HTTP method and URL pattern filtering
11//! - Trusted proxy validation (RFC 7239 compliant)
12//! - Structured logging with JSON support
13//!
14//! # Example
15//!
16//! ```rust,no_run
17//! use wisegate::{config, RateLimiter};
18//!
19//! // Get configuration from environment
20//! let rate_config = config::get_rate_limit_config();
21//! let proxy_config = config::get_proxy_config();
22//!
23//! // Create a rate limiter
24//! let limiter = RateLimiter::new();
25//! ```
26//!
27//! # Modules
28//!
29//! - [`config`] - Configuration management from environment variables
30//! - [`env_vars`] - Environment variable constants
31//! - [`server`] - Server utilities and startup info
32//! - [`args`] - Command line argument parsing
33//!
34//! # Re-exports from wisegate-core
35//!
36//! Core functionality is provided by the `wisegate-core` crate:
37//! - [`ip_filter`] - IP validation, extraction, and filtering
38//! - [`rate_limiter`] - Rate limiting implementation
39//! - [`request_handler`] - HTTP request processing and forwarding
40
41#![forbid(unsafe_code)]
42
43pub mod args;
44pub mod config;
45pub mod connection;
46pub mod env_vars;
47pub mod server;
48
49// Re-export wisegate-core modules
50pub use wisegate_core::ip_filter;
51pub use wisegate_core::rate_limiter;
52pub use wisegate_core::request_handler;
53pub use wisegate_core::types;
54
55// Re-export commonly used items at crate root
56pub use config::{
57    EnvVarConfig, get_allowed_proxy_ips, get_blocked_ips, get_blocked_methods,
58    get_blocked_patterns, get_max_connections, get_proxy_config, get_rate_limit_cleanup_config,
59    get_rate_limit_config,
60};
61pub use wisegate_core::{
62    // Aggregated configuration trait
63    ConfigProvider,
64    // Composable configuration traits
65    ConnectionProvider,
66    FilteringProvider,
67    // Configuration structs
68    ProxyConfig,
69    ProxyProvider,
70    RateLimitCleanupConfig,
71    RateLimitConfig,
72    // Rate limiting types
73    RateLimitEntry,
74    RateLimiter,
75    RateLimitingProvider,
76};