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
//! # LogProx
//!
//! An HTTP proxy with conditional request logging, request dropping, and response logging,
//! all driven by regex-based rules in a YAML config file.
//!
//! ## Proxy URL format
//!
//! Clients send requests to LogProx with the upstream URL embedded in the path:
//!
//! ```text
//! http://localhost:3000/https://api.example.com/v1/users
//! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ upstream URL
//! ```
//!
//! ## Embedding
//!
//! LogProx is primarily used as a standalone binary (`cargo run` / `./logprox`), but the
//! axum handlers are public so you can embed it into a larger axum application:
//!
//! ```rust,no_run
//! use axum::{Router, routing::get};
//! use logprox::{config::{Config, ConfigHolder}, proxy_handler, get_health_check};
//! use std::sync::Arc;
//!
//! #[tokio::main]
//! async fn main() {
//! let config = Config::from_file("config.yaml").unwrap();
//! let state = Arc::new(ConfigHolder::new(config));
//! let app: Router = Router::new()
//! .route("/health", get(get_health_check))
//! .fallback(proxy_handler)
//! .with_state(state);
//! // axum::serve(listener, app).await.unwrap();
//! }
//! ```
//!
//! ## Configuration
//!
//! See [`config::Config`] and the `/config/docs` endpoint (served by [`get_config_docs`])
//! for full configuration reference.
pub use ;
pub use ;