diff --git a/commands/registration.go b/commands/registration.go index 2f43c4ca..9561f8cc 100644 --- a/commands/registration.go +++ b/commands/registration.go @@ -94,12 +94,12 @@ func (g *registration) Check() error { switch g.action { case "add": if g.username == "" { - return errors.New("Username must be supplied") + return errors.New("username must be supplied") } case "del": if g.token == "" && g.username == "" { - return errors.New("Token or username must be supplied") + return errors.New("token or username must be supplied") } case "list": default: diff --git a/internal/router/statemachine.go b/internal/router/statemachine.go index 3beb0c4b..1f0ab257 100644 --- a/internal/router/statemachine.go +++ b/internal/router/statemachine.go @@ -209,6 +209,7 @@ func clusterState(errorsChan chan<- error) func(string) { hasDied = true log.Println("Cluster has entered dead state, tearing down: ", hasDied) TearDown(false) + log.Println("cluster finished tearing down") } case "healthy": if hasDied { diff --git a/internal/router/wireguard.go b/internal/router/wireguard.go index ff78dd92..cef6e63a 100644 --- a/internal/router/wireguard.go +++ b/internal/router/wireguard.go @@ -54,24 +54,24 @@ func setupWireguard(devices []data.Device) error { conn, err := netlink.Dial(unix.NETLINK_ROUTE, nil) if err != nil { - return err + return fmt.Errorf("failed to connect to netlink: err: %s", err) } defer conn.Close() ip, network, err := net.ParseCIDR(config.Values.Wireguard.Address) if err != nil { - return err + return fmt.Errorf("failed to parse wireguard address: err: %s", err) } network.IP = ip.To4()[:4] // Stop netlink freaking out at a ipv6 length ipv4 address err = addWg(conn, config.Values.Wireguard.DevName, *network, config.Values.Wireguard.MTU) if err != nil { - return err + return fmt.Errorf("failed to create wireguard device: err: %s", err) } key, err := wgtypes.ParseKey(config.Values.Wireguard.PrivateKey) if err != nil { - return err + return fmt.Errorf("failed to parse wireguard private key: err: %s", err) } c.PrivateKey = &key @@ -108,12 +108,12 @@ func setupWireguard(devices []data.Device) error { var err error ctrl, err = wgctrl.New() if err != nil { - return fmt.Errorf("cannot start wireguard control %v", err) + return fmt.Errorf("cannot start wireguard control: err: %s", err) } err = ctrl.ConfigureDevice(config.Values.Wireguard.DevName, c) if err != nil { - return fmt.Errorf("cannot configure wireguard device %v", err) + return fmt.Errorf("cannot configure wireguard device: err: %s", err) }