Skip to main content

tiny_proxy/cli/
args.rs

1use clap::Parser;
2
3/// Command line arguments for the proxy server
4#[derive(Parser, Debug)]
5#[command(author, version, about, long_about = None)]
6pub struct Cli {
7    /// Path to configuration file (Caddy-like format)
8    #[arg(short, long, default_value = "./file.caddy")]
9    pub config: String,
10
11    /// Address for proxy server to listen on.
12    /// When omitted, auto-detects listeners from config (one per site address).
13    /// Use this to override when you want a single listener on a specific address.
14    #[arg(short = 'a', long)]
15    pub addr: Option<String>,
16
17    /// Max concurrent connections (default: CPU cores * 256, use 0 for default)
18    #[arg(long, default_value_t = 0)]
19    pub max_concurrency: usize,
20
21    /// Enable management API server (requires 'api' feature)
22    #[arg(long)]
23    pub enable_api: bool,
24
25    /// Address for API server to listen on
26    #[arg(long, default_value = "127.0.0.1:8081")]
27    pub api_addr: String,
28}