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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(
name = "netweft",
version,
about = "Deterministic network planning and configuration generation"
)]
pub struct Cli {
/// Override the Netweft source configuration directory.
#[arg(long, global = true, env = "NETWEFT_CONFIG_DIR")]
pub config_dir: Option<PathBuf>,
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Subcommand)]
pub enum Command {
/// Print the resolved Netweft filesystem paths.
Paths,
/// Load and validate the configuration.
Validate {
/// Override the active location from netweft.toml.
#[arg(long)]
location: Option<String>,
},
/// Inspect typed or derived configuration objects.
Show {
#[command(subcommand)]
command: ShowCommand,
},
/// Generate configuration artifacts without deploying them.
Render {
#[command(subcommand)]
command: RenderCommand,
},
/// Inspect adapters compiled into this Netweft binary.
Adapters {
#[command(subcommand)]
command: AdapterCommand,
},
}
#[derive(Debug, Subcommand)]
pub enum ShowCommand {
/// Print a summary of the selected configuration.
Config,
/// List stable hosts.
Hosts,
/// List stable logical networks.
Networks,
/// List services.
Services,
/// Show networks automatically allowed to use DNS recursion.
DnsAccess,
/// Show the resolved DNS plan without generating files.
Dns,
/// Show the resolved location-aware Cloudflare ingress plan.
Cloudflare,
/// Show the resolved Docker networking plan.
Docker {
#[arg(long)]
host: String,
},
/// Show the provider-neutral reverse-proxy plan.
Proxy,
/// Show resolved SSH client aliases.
Ssh {
#[arg(long)]
client: String,
},
/// Show the generated environment plan for a host.
Env {
#[arg(long)]
host: String,
},
/// Show the resolved operating-system network plan for a host.
HostNetwork {
#[arg(long)]
host: String,
},
/// Show resolved operating-system network configuration for a host.
OsNetwork {
#[arg(long)]
host: String,
},
/// Show resolved Proxmox SDN configuration for a host.
ProxmoxSdn {
#[arg(long)]
host: String,
},
/// Show resolved Proxmox VM/LXC guest identities and addresses.
Guests,
/// Show resolved network mounts for a host.
NetworkMounts {
#[arg(long)]
host: String,
},
/// Show resolved NAS-side network permissions.
NasPermissions {
#[arg(long)]
nas: Option<String>,
},
/// Show resolved Proxmox storage for a host.
ProxmoxStorage {
#[arg(long)]
host: String,
},
}
#[derive(Debug, Subcommand)]
pub enum RenderCommand {
/// Render a complete BIND configuration for the active location.
Bind,
/// Render native Nginx reverse-proxy configuration.
Nginx {
/// Restrict rendering to proxies deployed on this host.
#[arg(long)]
host: Option<String>,
/// Run nginx -t after rendering.
#[arg(long)]
check: bool,
/// Nginx executable used by --check.
#[arg(long, default_value = "nginx")]
nginx: PathBuf,
},
/// Render location-resolved OpenSSH client configuration.
Ssh {
#[arg(long)]
client: String,
},
/// Render Cloudflare Tunnel, DNS reconciliation, and connector deployment.
Cloudflare {
#[arg(long)]
tunnel: Option<String>,
},
/// Render Docker daemon and named-network reconciliation.
Docker {
#[arg(long)]
host: String,
},
/// Render Docker Compose and shell environment files for a host.
Env {
#[arg(long)]
host: String,
},
/// Render Ubuntu Netplan host networking.
Netplan {
#[arg(long)]
host: String,
},
/// Render Proxmox ifupdown2 host networking.
Proxmox {
#[arg(long)]
host: String,
},
/// Render systemd network mount units and service dependencies.
SystemdMounts {
#[arg(long)]
host: String,
},
/// Render a Synology NFS permission action plan.
SynologyNfsPermissions {
#[arg(long)]
nas: String,
},
/// Render Proxmox guest reconciliation and deployment scripts.
ProxmoxGuests {
#[arg(long)]
host: String,
},
/// Render Proxmox SDN reconciliation and deployment scripts.
ProxmoxSdn {
#[arg(long)]
host: String,
},
/// Render Proxmox storage configuration and deployment scripts.
ProxmoxStorage {
#[arg(long)]
host: String,
},
/// Render all artifacts for a host.
All {
#[arg(long)]
host: String,
},
}
#[derive(Debug, Subcommand)]
pub enum AdapterCommand {
/// List adapters and their capabilities.
List,
}