Merge pull request #1468 from gravitl/feature_v0.14.9_node_disconnect

Feature v0.14.9 node disconnect
This commit is contained in:
Alex Feiszli
2022-08-30 11:15:12 -04:00
committed by GitHub
16 changed files with 188 additions and 55 deletions

View File

@@ -3,6 +3,7 @@ package command
import (
"crypto/ed25519"
"crypto/rand"
"fmt"
"strings"
"github.com/gravitl/netmaker/logger"
@@ -142,3 +143,27 @@ func Daemon() error {
func Install() error {
return functions.Install()
}
// Connect - re-instates a connection of a node
func Connect(cfg config.ClientConfig) error {
networkName := cfg.Network
if networkName == "" {
networkName = cfg.Node.Network
}
if networkName == "all" {
return fmt.Errorf("no network specified")
}
return functions.Connect(networkName)
}
// Disconnect - disconnects a connection of a node
func Disconnect(cfg config.ClientConfig) error {
networkName := cfg.Network
if networkName == "" {
networkName = cfg.Node.Network
}
if networkName == "all" {
return fmt.Errorf("no network specified")
}
return functions.Disconnect(networkName)
}