Skip to main content

decdn_common/cli/
probe.rs

1//! Arguments for the `decdn probe` subcommand.
2
3use std::net::SocketAddr;
4
5use clap::Args;
6
7/// Probe a running deCDN node over the `cdn/probe/v1` ALPN.
8///
9/// Connects to the target node, sends a [`ProbeRequest`](decdn_protocol::message::ProbeRequest),
10/// and prints the [`ProbeResponse`](decdn_protocol::message::ProbeResponse). Reachability (a
11/// direct `--addr` or a relay) is validated at runtime rather than by a clap `ArgGroup`,
12/// because the relay can also come from config (`network.relay_urls`, #935).
13#[derive(Args, Debug)]
14pub struct ProbeArgs {
15    /// Target node id (iroh `EndpointId`, z-base32).
16    #[arg(long, value_name = "ID")]
17    pub node_id: String,
18
19    /// BLAKE3 hash of the blob to query availability for: 64 hex chars
20    /// (optional `0x` prefix), the same form `cache.pinned_hashes` accepts.
21    /// `cdn/probe/v1` is a content-availability query — the node answers
22    /// whether it holds this blob (ADR 005).
23    #[arg(long, value_name = "HASH")]
24    pub hash: String,
25
26    /// Direct socket address of the target node (e.g. `127.0.0.1:4433`).
27    #[arg(long, value_name = "HOST:PORT")]
28    pub addr: Option<SocketAddr>,
29
30    /// iroh relay URL to use for discovery-based resolution. Overrides
31    /// `network.relay_urls` from config when set (#935); omit it to use the
32    /// configured relays.
33    #[arg(long, value_name = "URL")]
34    pub relay_url: Option<String>,
35
36    /// Overall timeout for the probe roundtrip, in milliseconds.
37    #[arg(long, value_name = "MS", default_value_t = 5000)]
38    pub timeout_ms: u64,
39
40    /// Print the response as a single line of JSON instead of a pretty block.
41    #[arg(long)]
42    pub json: bool,
43}