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
+16
View File
@@ -38,6 +38,10 @@ type Status struct {
TailscaleIPs []netaddr.IP // Tailscale IP(s) assigned to this node
Self *PeerStatus
// ExitNodeStatus describes the current exit node.
// If nil, an exit node is not in use.
ExitNodeStatus *ExitNodeStatus `json:"ExitNodeStatus,omitempty"`
// Health contains health check problems.
// Empty means everything is good. (or at least that no known
// problems are detected)
@@ -81,6 +85,18 @@ type TailnetStatus struct {
MagicDNSEnabled bool
}
// ExitNodeStatus describes the current exit node.
type ExitNodeStatus struct {
// ID is the exit node's ID.
ID tailcfg.StableNodeID
// Online is whether the exit node is alive.
Online bool
// TailscaleIPs are the exit node's IP addresses assigned to the node.
TailscaleIPs []netaddr.IPPrefix
}
func (s *Status) Peers() []key.NodePublic {
kk := make([]key.NodePublic, 0, len(s.Peer))
for k := range s.Peer {