From 91d135e06927a7fdfb8f1315c941d25df39cbe4f Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Thu, 14 Oct 2021 23:54:07 +0200 Subject: [PATCH 1/4] Show JSON when error on expire key (fixes #162) --- cmd/headscale/cli/preauthkeys.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/headscale/cli/preauthkeys.go b/cmd/headscale/cli/preauthkeys.go index cb75b287..caa9201b 100644 --- a/cmd/headscale/cli/preauthkeys.go +++ b/cmd/headscale/cli/preauthkeys.go @@ -153,6 +153,10 @@ var expirePreAuthKeyCmd = &cobra.Command{ k, err := h.GetPreAuthKey(n, args[0]) if err != nil { + if strings.HasPrefix(o, "json") { + JsonOutput(k, err, o) + return + } log.Fatalf("Error getting the key: %s", err) } From 0d13e16fed9a57b100fe3262f3cc6f533950a431 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Thu, 14 Oct 2021 23:58:15 +0200 Subject: [PATCH 2/4] Improve help message to expire key (fixes #161) --- cmd/headscale/cli/preauthkeys.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/headscale/cli/preauthkeys.go b/cmd/headscale/cli/preauthkeys.go index cb75b287..421e7ef4 100644 --- a/cmd/headscale/cli/preauthkeys.go +++ b/cmd/headscale/cli/preauthkeys.go @@ -131,7 +131,7 @@ var createPreAuthKeyCmd = &cobra.Command{ } var expirePreAuthKeyCmd = &cobra.Command{ - Use: "expire", + Use: "expire KEY", Short: "Expire a preauthkey", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { From 985c6e7cc90b8d896afac8e1a236756b8aa46011 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Fri, 15 Oct 2021 00:04:04 +0200 Subject: [PATCH 3/4] Preload AuthKey Namespace on list nodes (fixes #163) --- namespaces.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namespaces.go b/namespaces.go index 2bf62bb3..e109b9a7 100644 --- a/namespaces.go +++ b/namespaces.go @@ -91,7 +91,7 @@ func (h *Headscale) ListMachinesInNamespace(name string) (*[]Machine, error) { } machines := []Machine{} - if err := h.db.Preload("AuthKey").Preload("Namespace").Where(&Machine{NamespaceID: n.ID}).Find(&machines).Error; err != nil { + if err := h.db.Preload("AuthKey").Preload("AuthKey.Namespace").Preload("Namespace").Where(&Machine{NamespaceID: n.ID}).Find(&machines).Error; err != nil { return nil, err } return &machines, nil From 5807562b56a584124ac5ebe8af63766c75188937 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Fri, 15 Oct 2021 17:00:04 +0200 Subject: [PATCH 4/4] Add arm64 binaries --- .goreleaser.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 7b1ea605..f7355104 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -20,6 +20,7 @@ builds: - -mod=readonly ldflags: - -s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=v{{.Version}} + - id: linux-armhf main: ./cmd/headscale/headscale.go mod_timestamp: '{{ .CommitTimestamp }}' @@ -49,9 +50,16 @@ builds: - linux goarch: - amd64 - goarm: - - 6 - - 7 + main: ./cmd/headscale/headscale.go + mod_timestamp: '{{ .CommitTimestamp }}' + ldflags: + - -s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=v{{.Version}} + + - id: linux-arm64 + goos: + - linux + goarch: + - arm64 main: ./cmd/headscale/headscale.go mod_timestamp: '{{ .CommitTimestamp }}' ldflags: @@ -63,6 +71,7 @@ archives: - darwin-amd64 - linux-armhf - linux-amd64 + - linux-arm64 name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" format: binary