cmd/tailscale: surface node-key for locked out tailnet-lock peers

Signed-off-by: Tom DNetto <tom@tailscale.com>
This commit is contained in:
Tom DNetto 2023-03-08 14:16:23 -08:00 committed by Tom
parent b797f773c7
commit 3471fbf8dc
4 changed files with 7 additions and 1 deletions

View File

@ -247,11 +247,13 @@ func runNetworkLockStatus(ctx context.Context, args []string) error {
for i, addr := range p.TailscaleIPs { for i, addr := range p.TailscaleIPs {
line.WriteString(addr.String()) line.WriteString(addr.String())
if i < len(p.TailscaleIPs)-1 { if i < len(p.TailscaleIPs)-1 {
line.WriteString(", ") line.WriteString(",")
} }
} }
line.WriteString("\t") line.WriteString("\t")
line.WriteString(string(p.StableID)) line.WriteString(string(p.StableID))
line.WriteString("\t")
line.WriteString(p.NodeKey.String())
fmt.Println(line.String()) fmt.Println(line.String())
} }
} }

View File

@ -106,6 +106,7 @@ func (b *LocalBackend) tkaFilterNetmapLocked(nm *netmap.NetworkMap) {
ID: p.ID, ID: p.ID,
StableID: p.StableID, StableID: p.StableID,
TailscaleIPs: make([]netip.Addr, len(p.Addresses)), TailscaleIPs: make([]netip.Addr, len(p.Addresses)),
NodeKey: p.Key,
} }
for i, addr := range p.Addresses { for i, addr := range p.Addresses {
if addr.IsSingleIP() && tsaddr.IsTailscaleIP(addr.Addr()) { if addr.IsSingleIP() && tsaddr.IsTailscaleIP(addr.Addr()) {

View File

@ -88,6 +88,7 @@ type TKAFilteredPeer struct {
ID tailcfg.NodeID ID tailcfg.NodeID
StableID tailcfg.StableNodeID StableID tailcfg.StableNodeID
TailscaleIPs []netip.Addr // Tailscale IP(s) assigned to this node TailscaleIPs []netip.Addr // Tailscale IP(s) assigned to this node
NodeKey key.NodePublic
} }
// NetworkLockStatus represents whether network-lock is enabled, // NetworkLockStatus represents whether network-lock is enabled,

View File

@ -9,6 +9,7 @@
"net/netip" "net/netip"
"tailscale.com/tailcfg" "tailscale.com/tailcfg"
"tailscale.com/types/key"
) )
// Clone makes a deep copy of TKAFilteredPeer. // Clone makes a deep copy of TKAFilteredPeer.
@ -29,4 +30,5 @@ func (src *TKAFilteredPeer) Clone() *TKAFilteredPeer {
ID tailcfg.NodeID ID tailcfg.NodeID
StableID tailcfg.StableNodeID StableID tailcfg.StableNodeID
TailscaleIPs []netip.Addr TailscaleIPs []netip.Addr
NodeKey key.NodePublic
}{}) }{})