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
//! An HTTP reverse proxy built on [hyper], [tokio], and [rustls].
//!
//! This crate provides the core proxy logic: configuration loading with
//! pre-compiled regex patterns, request forwarding with body streaming,
//! header and parameter blocking for GET requests, sensitive data
//! masking in response bodies, weighted round-robin load balancing with
//! passive and active health checks, structured observability via [tracing],
//! configurable timeouts, connection pool tuning, concurrency limiting,
//! per-IP rate limiting, and graceful shutdown.
//!
//! Every inbound request is assigned a monotonic request ID, injected
//! into the response as an `X-Request-Id` header, and wrapped in a
//! [`tracing::Span`] carrying the request method, URI, and client
//! address as structured fields.
//!
//! # Example
//!
//! Load a YAML configuration, build an HTTP client, and forward a single
//! request programmatically:
//!
//! ```rust,no_run
//! use std::net::SocketAddr;
//! use std::sync::Arc;
//!
//! use palisade::{
//! Config, LoadBalancer, UpstreamPool, build_client, handle_request,
//! };
//!
//! #[tokio::main]
//! async fn main() {
//! let config = Config::load_from_file("Config.yml")
//! .and_then(|c| c.into_runtime())
//! .expect("valid configuration");
//!
//! let client = build_client(&config);
//! let pool = UpstreamPool::from_validated(&config.upstreams);
//! let balancer = LoadBalancer::new(pool);
//! let config = Arc::new(config);
//!
//! let req = hyper::Request::builder()
//! .uri("http://localhost/hello")
//! .body(http_body_util::Empty::<bytes::Bytes>::new())
//! .unwrap();
//!
//! let resp = handle_request(
//! req,
//! client,
//! config,
//! balancer,
//! SocketAddr::from(([127, 0, 0, 1], 0)),
//! None,
//! )
//! .await
//! .expect("proxy succeeded");
//!
//! println!("status: {}", resp.status());
//! }
//! ```
//!
//! [hyper]: https://hyper.rs/
//! [tokio]: https://tokio.rs/
//! [rustls]: https://docs.rs/rustls
//! [tracing]: https://docs.rs/tracing
pub use LoadBalancer;
pub use ;
pub use ProxyError;
pub use ;
pub use IpRateLimiter;
pub use ;
pub type Result<T> = Result;