[PATCH] wg show: Add json output

Kalin KOZHUHAROV me.kalin at gmail.com
Tue Feb 25 15:50:47 CET 2020


Hi Barry,

Please read the reply below with a smile, it is just friendly sarcasm
underlining my personal view.

On Tue, Feb 25, 2020 at 1:50 AM Barry Scott <barry at barrys-emacs.org> wrote:
> > On 23 Feb 2020, at 12:45, Arti Zirk <arti.zirk at gmail.com> wrote:
> >
> > On E, 2020-02-17 at 15:47 +1100, Matthew Oliver wrote:
> >> Someone asked about this in the IRC channel, so quickly wrote up a
> >> patch to add it. No pressure if you do/don't want to merge it :)
> >
> > If you have wireguard-tools package installed then it should be
> > possible to use the incldued wg-json script to do the same
> >
> >  sudo /usr/share/wireguard-tools/examples/json/wg-json
>
> When I built my tools in python on top of the wg command I was
> please to see a machine interface, but find the \t separated list
> of values odd to find in a modern app.
>
... and it doesn't support dark-mode for the matter! Neither has it
autoupdate script!
And no PDF documentation generated by doxygen! And no JNI !

May be it is just a simple & easy, robust tool that does one thing and
does it good and fast?

> I think it would be a good addition to have the JSON output
> without the need to use a contrib script. Many text commands
> output in JSON or XML for ease of interfacing.
>
So, sarcasm aside, I really think keeping it simple is better.
If you need JSON for some reason, use the script in contrib and patch
if it doesn't work as needed, or suggest another script or way,
without strapping a kitchen sink to the core.
And for tighter integration, use the Netlink API (uapi/wireguard.h) directly.

> The JSON would also provide a nice way to add more attributes
> in the future.
>
Adding "more attributes" is definitely not on the todo list, AFAIK,
and given that in the remote case of adding a secondary output format
(json) it may need to be backward compatible with the default text
output, this is not a reason.
In the sense that if we add a plugin for Alexa to explain a wg output,
auto-magically translating it of course, there is a high chance of it
being only a secondary priority (to the simple text output).

Cheers,
Kalin.


More information about the WireGuard mailing list