diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-28 11:18:14 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-28 11:18:42 +0100 |
| commit | e9f8db8ee8fccf60e58deb1d72766f94a053bb16 (patch) | |
| tree | ffa5a9be67717ecc8ff7bdc03d5f96028facb0e3 /internal/wireguard/wireguard.go | |
| parent | b4ff890ec2b459148d893499a34a6d2954530369 (diff) | |
Document: Add comments for most functions and packages
Errors and test files still need to be done. Also some getters are
changed by removing the 'get' prefix
Diffstat (limited to 'internal/wireguard/wireguard.go')
| -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]" |
