tokio_multi_proxy/
lib.rs

1//! # tokio-multi-proxy
2//!
3//! `tokio-multi-proxy` is a modular, async multi-interface proxy built with [Tokio](https://tokio.rs) and [Rustls](https://github.com/rustls/rustls).
4//!
5//! It supports three modes of operation:
6//!
7//! - **Plain TCP passthrough** (default)
8//! - **TLS termination** (`--features tls`)
9//! - **Mutual TLS (mTLS)** with client authentication (`--features mtls`)
10//!
11//! ## Feature Flags
12//!
13//! | Feature     | Description                         |
14//! |-------------|-------------------------------------|
15//! | `passthrough` | Raw TCP proxying (enabled by default) |
16//! | `tls`         | TLS termination on incoming connections |
17//! | `mtls`        | Mutual TLS (requires `tls`)           |
18//!
19//! ## Example
20//!
21//! ```rust,no_run
22//! #[tokio::main]
23//! async fn main() -> anyhow::Result<()> {
24//!     tokio_multi_proxy::start_tcp("0.0.0.0:8080", "127.0.0.1:9000").await
25//! }
26//! ```
27
28#![cfg_attr(docsrs, feature(doc_cfg))]
29
30
31pub mod tcp;
32pub mod udp;
33pub mod unix;
34#[cfg(feature = "tls")]
35#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
36pub mod tls;
37
38
39pub use tcp::start_tcp;
40pub use udp::start_udp;
41pub use unix::start_unix;
42
43
44#[cfg(feature = "tls")]
45#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
46pub use tls::start_tls_tcp;
47
48#[cfg(feature = "mtls")]
49#[cfg_attr(docsrs, doc(cfg(feature = "mtls")))]
50pub use tls::start_mtls_tcp;