This is a convenience wrapper around
/sbin/ip
- the go wgctrl lib
to easily
- create and delete wireguard interfaces,
- configure them with keys, endpoints etc.,
- manage peers
It does not have a CLI but is intended as a library only. See examples/main.go for details.
This builds on Linux only because it is intended primarily for linux only.
e.g. use multipass to launch an ubuntu lts named wgtest:
$ multipass launch -c 1 -m 512M -n wgtest --cloud-init scripts/multipass-cloudinit.yaml lts
$ multipass mount $(pwd) wgtest:/mnt
$ multipass shell wgtest
ubuntu@wgtest:~$ sudo -i
root@wgtest:~# cd /mnt
Cloud-init script will install wireguard tools and go. Please run go / the binary as root since
it calls /sbin/ip
and accesses wireguard via netlink.
$ go test -cover ./pkg/...
ok github.com/aschmidt75/go-wg-wrapper/pkg/wgwrapper (cached) coverage: 72.0% of statements
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright 2020,2021 @aschmidt75 Licensed under the Apache License, Version 2.0