implmented report card suggestions

This commit is contained in:
Neven Miculinic 2019-03-28 12:43:34 +01:00
parent f0b2e9f85a
commit 875513e4af
2 changed files with 4 additions and 3 deletions

View File

@ -13,6 +13,7 @@ import (
"time"
)
// Config represents full wg-quick like config structure
type Config struct {
wgtypes.Config
@ -106,7 +107,7 @@ AllowedIPs = {{ range $i, $el := .AllowedIPs }}{{if $i}}, {{ end }}{{ $el }}{{ e
{{- end }}
`
// Parses base64 encoded wireguard private key
// ParseKey parses the base64 encoded wireguard private key
func ParseKey(key string) (wgtypes.Key, error) {
var pkey wgtypes.Key
pkeySlice, err := base64.StdEncoding.DecodeString(key)

4
wg.go
View File

@ -47,7 +47,7 @@ func Up(cfg *Config, iface string, logger logrus.FieldLogger) error {
return nil
}
// Down destroyes the wg interface. Mostly equivalent to `wg-quick down iface`
// Down destroys the wg interface. Mostly equivalent to `wg-quick down iface`
func Down(cfg *Config, iface string, logger logrus.FieldLogger) error {
log := logger.WithField("iface", iface)
link, err := netlink.LinkByName(iface)
@ -224,7 +224,7 @@ func SyncAddress(cfg *Config, link netlink.Link, log logrus.FieldLogger) error {
return nil
}
// SyncAddress adds/deletes all route assigned IPV4 addressed as specified in the config
// SyncRoutes adds/deletes all route assigned IPV4 addressed as specified in the config
func SyncRoutes(cfg *Config, link netlink.Link, log logrus.FieldLogger) error {
routes, err := netlink.RouteList(link, syscall.AF_INET)
if err != nil {