Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
kradalby authored May 8, 2022
2 parents ed46491 + 91b95ff commit 21268f7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/headscale/cli/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/pterm/pterm"
"github.com/spf13/cobra"
"google.golang.org/grpc/status"
"inet.af/netaddr"
"tailscale.com/types/key"
)

Expand Down Expand Up @@ -452,14 +453,25 @@ func nodesToPtables(
// Shared into this namespace
namespace = pterm.LightYellow(machine.Namespace.Name)
}

var IpV4Address string
var IpV6Address string
for _, addr := range machine.IpAddresses {
if netaddr.MustParseIP(addr).Is4() {
IpV4Address = addr
} else {
IpV6Address = addr
}
}

tableData = append(
tableData,
[]string{
strconv.FormatUint(machine.Id, headscale.Base10),
machine.Name,
nodeKey.ShortString(),
namespace,
strings.Join(machine.IpAddresses, ", "),
strings.Join([]string{IpV4Address, IpV6Address}, ", "),
strconv.FormatBool(ephemeral),
lastSeenTime,
online,
Expand Down

0 comments on commit 21268f7

Please sign in to comment.