diff options
Diffstat (limited to 'internal/wireguard')
| -rw-r--r-- | internal/wireguard/wireguard.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/wireguard/wireguard.go b/internal/wireguard/wireguard.go index bbb22e4..d9bd974 100644 --- a/internal/wireguard/wireguard.go +++ b/internal/wireguard/wireguard.go @@ -1,3 +1,4 @@ +// package wireguard implements a few helpers for the WireGuard protocol package wireguard import ( @@ -8,6 +9,8 @@ import ( "golang.zx2c4.com/wireguard/wgctrl/wgtypes" ) +// GenerateKey generates a WireGuard private key using wgctrl +// It returns an error if key generation failed func GenerateKey() (wgtypes.Key, error) { key, keyErr := wgtypes.GeneratePrivateKey() @@ -20,6 +23,7 @@ func GenerateKey() (wgtypes.Key, error) { return key, nil } +// ConfigAddKey takes the WireGuard configuration and adds the PrivateKey to the right section // FIXME: Instead of doing a regex replace, decide if we should use a parser func ConfigAddKey(config string, key wgtypes.Key) string { interfaceSection := "[Interface]" |
