diff --git a/cmd/addpeer.go b/cmd/addpeer.go index 0caaaeb07..c03af7021 100644 --- a/cmd/addpeer.go +++ b/cmd/addpeer.go @@ -40,6 +40,6 @@ var ( func init() { addPeerCmd.PersistentFlags().StringVar(&key, "key", "", "Wireguard public key of the remote peer") addPeerCmd.PersistentFlags().StringVar(&allowedIPs, "allowedIPs", "", "Wireguard Allowed IPs for the remote peer, e.g 10.30.30.2/32") - addPeerCmd.MarkPersistentFlagRequired("key") - addPeerCmd.MarkPersistentFlagRequired("allowedIPs") + addPeerCmd.MarkPersistentFlagRequired("key") //nolint + addPeerCmd.MarkPersistentFlagRequired("allowedIPs") //nolint } diff --git a/cmd/config.go b/cmd/config.go index ad7640afe..b11ef24f6 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -8,6 +8,7 @@ import ( "os" ) +// Config Configuration type type Config struct { // Wireguard private key of local peer PrivateKey string diff --git a/cmd/init.go b/cmd/init.go index a66cf9a89..9569a26b7 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -109,10 +109,10 @@ func init() { //todo user:password@protocol:host:port not the best way to pass TURN credentials, do it according to https://tools.ietf.org/html/rfc7065 E.g. use oauth initCmd.PersistentFlags().StringVar(&turnURLs, "turnURLs", "", "Comma separated TURN server URLs: user:password@protocol:host:port, e.g. user:password@turn:stun.wiretrustee.com:3468") //initCmd.MarkPersistentFlagRequired("configPath") - initCmd.MarkPersistentFlagRequired("wgLocalAddr") - initCmd.MarkPersistentFlagRequired("signalAddr") - initCmd.MarkPersistentFlagRequired("stunURLs") - initCmd.MarkPersistentFlagRequired("turnURLs") + initCmd.MarkPersistentFlagRequired("wgLocalAddr") //nolint + initCmd.MarkPersistentFlagRequired("signalAddr") //nolint + initCmd.MarkPersistentFlagRequired("stunURLs") //nolint + initCmd.MarkPersistentFlagRequired("turnURLs") //nolint } // generateKey generates a new Wireguard private key diff --git a/cmd/root.go b/cmd/root.go index 014bd42e0..955b08a7a 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -10,6 +10,7 @@ import ( ) const ( + // ExitSetupFailed defines exit code ExitSetupFailed = 1 ) @@ -38,6 +39,7 @@ func init() { rootCmd.AddCommand(signalCmd) } +// SetupCloseHandler handles SIGTERM signal and exits with success func SetupCloseHandler() { c := make(chan os.Signal) signal.Notify(c, os.Interrupt, syscall.SIGTERM) @@ -46,10 +48,11 @@ func SetupCloseHandler() { os.Exit(0) } +// InitLog parses and sets log-level input func InitLog(logLevel string) { level, err := log.ParseLevel(logLevel) if err != nil { - log.Errorf("efailed parsing log-level %s: %s", logLevel, err) + log.Errorf("Failed parsing log-level %s: %s", logLevel, err) os.Exit(ExitSetupFailed) } log.SetLevel(level)