Skip to content

Commit

Permalink
Merge branch 'kradalby-patch-2' of github.com:juanfont/headscale into…
Browse files Browse the repository at this point in the history
… kradalby-patch-2
  • Loading branch information
kradalby committed Nov 28, 2021
2 parents 8e9a946 + 8932133 commit 2d2ae62
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cmd/headscale/cli/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ import (
"google.golang.org/grpc/status"
)

const (
keyLength = 64
errPreAuthKeyTooShort = Error("key too short, must be 64 hexadecimal characters")
)

// Error is used to compare errors as per https://dave.cheney.net/2016/04/07/constant-errors
type Error string

func (e Error) Error() string { return string(e) }

func init() {
rootCmd.AddCommand(debugCmd)

Expand Down Expand Up @@ -77,6 +87,16 @@ var createNodeCmd = &cobra.Command{

return
}
if len(machineKey) != keyLength {
err = errPreAuthKeyTooShort
ErrorOutput(
err,
fmt.Sprintf("Error: %s", err),
output,
)

return
}

routes, err := cmd.Flags().GetStringSlice("route")
if err != nil {
Expand Down

0 comments on commit 2d2ae62

Please sign in to comment.