Structure(d) output of wg?
Dan Lüdtke
mail at danrl.com
Wed Dec 14 21:04:16 CET 2016
Hi Jason, everyone,
I'd like to discuss the topic of structured output. I am working on luci-app-wireguard* which aims to provide status information via the user-friendly LUCI interface in LEDE. While writing code to parse the output I realized that I may not be the only one who needs to structure wg's output. Would it make sense to add support for structured output now and thus prevent/reduce parsers and half-baked solutions popping up in higher level software in the future?
Something like wg show --json
[
{
interface: "foo"
private_key: "(hidden)",
preshared_key: "(hidden)",
listen_port: "12345",
peers: [
{
public_key: "dfkdjkfjslfkd...",
bandwith: "...",
last_handshake: "..."
},
{
public_key: "sdj9ad....",
allowed_ips: "2001:db8::/64",
bandwith: "..."
}
]
},
{
interface: "foo2",
...you get the idea...
}
]
JSON is just one idea because it allows nice structuring. CSV, TSV or whatever is lean and easy to implement may be an equally good option. While structuring, we could also provide even more structure than the usual stdout of wg provides. Candidate for lists: allowed_ips
Candidate for sub-structures: bandwith (rx, tx)
What do you think?
Cheers,
Dan
*: Not to be confused with luci-proto-wireguard, kmod-wireguard, and wireguard-tools. They provide functionality and configuration interfaces, but not monitoring/fancy output.
More information about the WireGuard
mailing list