ipn/ipnstate: add ExitNodeStatus to share the exit node if it is in use, the IP, ID and whether its online. (#4761)

-
Updates #4619

Signed-off-by: nyghtowl <warrick@tailscale.com>
This commit is contained in:
Melanie Warrick
2022-06-07 12:31:10 -07:00
committed by GitHub
parent 6246fa32f0
commit 3a182d5dd6
3 changed files with 40 additions and 0 deletions

View File

@@ -122,6 +122,16 @@ func (nm *NetworkMap) VeryConcise() string {
return buf.String()
}
// PeerWithStableID finds and returns the peer associated to the inputted StableNodeID.
func (nm *NetworkMap) PeerWithStableID(pid tailcfg.StableNodeID) (_ *tailcfg.Node, ok bool) {
for _, p := range nm.Peers {
if p.StableID == pid {
return p, true
}
}
return nil, false
}
// printConciseHeader prints a concise header line representing nm to buf.
//
// If this function is changed to access different fields of nm, keep