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
49
50
51
52
53
54
55
56
57
58
// SPDX-FileCopyrightText: 2026 Gianluca Boiano
// SPDX-License-Identifier: GPL-3.0-or-later
//! `ntkd` command-line surface.
use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(name = "ntkd", version, about = "The Netsukuku routing daemon")]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand, Debug)]
pub enum Command {
/// Runs the daemon in the foreground.
Run {
/// Path to the TOML config file (see `kernel::config::NtkdConfig`).
#[arg(long)]
config: PathBuf,
/// Interface to monitor for neighbours; repeatable. Overrides the config file's `nics`
/// list entirely when given.
#[arg(long = "nic")]
nics: Vec<String>,
/// Log verbosity: `error`, `warn`, `info`, `debug`, or `trace`.
#[arg(long, default_value = "info")]
log_level: String,
/// Unix socket path the `status` subcommand connects to. Defaults to
/// `$RUNTIME_DIRECTORY/ntkd.sock`, else `/run/ntkd/ntkd.sock`.
#[arg(long)]
status_socket: Option<PathBuf>,
},
/// Queries a running daemon's status over its unix socket.
Status {
/// Unix socket path a running daemon's `run --status-socket` is listening on.
#[arg(long, default_value_os_t = crate::node::status::default_socket_path())]
socket: PathBuf,
},
/// Registers or renews a hostname against a running daemon's ANDNA.
AndnaRegister {
/// The hostname to register or renew.
hostname: String,
/// Unix socket path a running daemon's `run --status-socket` is listening on.
#[arg(long, default_value_os_t = crate::node::status::default_socket_path())]
socket: PathBuf,
},
/// Resolves a hostname against a running daemon's ANDNA.
AndnaResolve {
/// The hostname to resolve.
hostname: String,
/// Unix socket path a running daemon's `run --status-socket` is listening on.
#[arg(long, default_value_os_t = crate::node::status::default_socket_path())]
socket: PathBuf,
},
}