Skip to main content

decdn_common/cli/
gateway.rs

1//! Arguments for the `decdn gateway` subcommand.
2
3use std::net::SocketAddr;
4
5use clap::Args;
6
7use super::ClientFetchArgs;
8
9/// Serve `decdn:` URIs to a browser from a loopback HTTP gateway.
10#[derive(Args, Debug, Clone)]
11pub struct GatewayArgs {
12    /// Loopback address to listen on. `GET /<hash>[/<path>][?ns=<id>]` serves
13    /// `decdn:<hash>[/<path>][?ns=<id>]`.
14    #[arg(long, value_name = "ADDR", default_value = "127.0.0.1:8484")]
15    pub listen: SocketAddr,
16
17    /// Discovery and chain flags, as `decdn get` takes them. The gateway
18    /// holds its own delegate keys and registered capabilities, so the
19    /// keystore and capability flags do not apply. Chain coordinates that
20    /// neither a flag nor the config file sets default to the built-in
21    /// testnet, and `--data-dir` (where the gateway token lives) defaults to
22    /// `~/.decdn/gateway`.
23    #[command(flatten)]
24    pub common: ClientFetchArgs,
25}