mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-20 17:58:02 +02:00
fix doc and lint warns for the cmd package
This commit is contained in:
parent
6d339295be
commit
73720951d7
@ -40,6 +40,6 @@ var (
|
|||||||
func init() {
|
func init() {
|
||||||
addPeerCmd.PersistentFlags().StringVar(&key, "key", "", "Wireguard public key of the remote peer")
|
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.PersistentFlags().StringVar(&allowedIPs, "allowedIPs", "", "Wireguard Allowed IPs for the remote peer, e.g 10.30.30.2/32")
|
||||||
addPeerCmd.MarkPersistentFlagRequired("key")
|
addPeerCmd.MarkPersistentFlagRequired("key") //nolint
|
||||||
addPeerCmd.MarkPersistentFlagRequired("allowedIPs")
|
addPeerCmd.MarkPersistentFlagRequired("allowedIPs") //nolint
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Config Configuration type
|
||||||
type Config struct {
|
type Config struct {
|
||||||
// Wireguard private key of local peer
|
// Wireguard private key of local peer
|
||||||
PrivateKey string
|
PrivateKey string
|
||||||
|
@ -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
|
//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.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("configPath")
|
||||||
initCmd.MarkPersistentFlagRequired("wgLocalAddr")
|
initCmd.MarkPersistentFlagRequired("wgLocalAddr") //nolint
|
||||||
initCmd.MarkPersistentFlagRequired("signalAddr")
|
initCmd.MarkPersistentFlagRequired("signalAddr") //nolint
|
||||||
initCmd.MarkPersistentFlagRequired("stunURLs")
|
initCmd.MarkPersistentFlagRequired("stunURLs") //nolint
|
||||||
initCmd.MarkPersistentFlagRequired("turnURLs")
|
initCmd.MarkPersistentFlagRequired("turnURLs") //nolint
|
||||||
}
|
}
|
||||||
|
|
||||||
// generateKey generates a new Wireguard private key
|
// generateKey generates a new Wireguard private key
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// ExitSetupFailed defines exit code
|
||||||
ExitSetupFailed = 1
|
ExitSetupFailed = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -38,6 +39,7 @@ func init() {
|
|||||||
rootCmd.AddCommand(signalCmd)
|
rootCmd.AddCommand(signalCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetupCloseHandler handles SIGTERM signal and exits with success
|
||||||
func SetupCloseHandler() {
|
func SetupCloseHandler() {
|
||||||
c := make(chan os.Signal)
|
c := make(chan os.Signal)
|
||||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||||
@ -46,10 +48,11 @@ func SetupCloseHandler() {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InitLog parses and sets log-level input
|
||||||
func InitLog(logLevel string) {
|
func InitLog(logLevel string) {
|
||||||
level, err := log.ParseLevel(logLevel)
|
level, err := log.ParseLevel(logLevel)
|
||||||
if err != nil {
|
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)
|
os.Exit(ExitSetupFailed)
|
||||||
}
|
}
|
||||||
log.SetLevel(level)
|
log.SetLevel(level)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user