wireguardnl: Go package for interacting with WireGuard via generic netlink
Matt Layher
mdlayher at gmail.com
Sat Jul 21 21:19:22 CEST 2018
Hi all!
I've heard quite a few good things about WireGuard and decided to try it
out at home today. On top of that, I've done a lot of work with netlink
and generic netlink in Go, and decided to implement a Go package that
can use wireguard's generic netlink interface in the same way as the
"wg" tool. To avoid confusion with "wireguard" or "wireguard-go", I've
chosen "wireguardnl" as the name:
https://github.com/mdlayher/wireguardnl
This was just a fun experiment for me (it works, but no tests yet), but
perhaps it'll be useful for someone who wants to inspect the kernel
module from a Go program (no support for changing settings as of now,
but that'd be fun!).
While I'm here, I did have one inquiry about "WG_CMD_GET_DEVICE": after
working with a handful of generic netlink families, I was slightly
surprised to see that a request paired with "NLM_F_DUMP" doesn't return
a list of all WireGuard devices from the kernel.
Per the documentation, sending an interface index or name attribute
works just fine to retrieve a single device, but perhaps it'd be nice to
be able to just dump a list of all WireGuard devices when "NLM_F_DUMP"
and no attributes are specified. For the time being, I can easily work
around this with my "Devices" method by attempting to query the kernel
for WireGuard device information about each of my network interfaces,
and then filter out the ones that return "ENOTSUP".
Thanks for WireGuard, it seems extremely promising so far!
- Matt Layher
More information about the WireGuard
mailing list