Skip to content

Commit

Permalink
Show MachineKey in node table
Browse files Browse the repository at this point in the history
Added missing column
  • Loading branch information
juanfont committed Dec 13, 2022
1 parent ba61f02 commit 991abae
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/headscale/cli/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ func nodesToPtables(
"ID",
"Hostname",
"Name",
"MachineKey",
"NodeKey",
"Namespace",
"IP addresses",
Expand Down Expand Up @@ -504,8 +505,16 @@ func nodesToPtables(
expiry = machine.Expiry.AsTime()
}

var machineKey key.MachinePublic
err := machineKey.UnmarshalText(
[]byte(headscale.MachinePublicKeyEnsurePrefix(machine.MachineKey)),
)
if err != nil {
machineKey = key.MachinePublic{}
}

var nodeKey key.NodePublic
err := nodeKey.UnmarshalText(
err = nodeKey.UnmarshalText(
[]byte(headscale.NodePublicKeyEnsurePrefix(machine.NodeKey)),
)
if err != nil {
Expand Down Expand Up @@ -570,6 +579,7 @@ func nodesToPtables(
strconv.FormatUint(machine.Id, headscale.Base10),
machine.Name,
machine.GetGivenName(),
machineKey.ShortString(),
nodeKey.ShortString(),
namespace,
strings.Join([]string{IPV4Address, IPV6Address}, ", "),
Expand Down

0 comments on commit 991abae

Please sign in to comment.