ipn/{ipnlocal,ipnstate}: add Tags and PrimaryRoutes to PeerStatus

Signed-off-by: Maisem Ali <maisem@tailscale.com>
pull/4001/head
Maisem Ali 3 years ago committed by Maisem Ali
parent 0fc1479633
commit 9cbb0913be

@ -448,6 +448,8 @@ func (b *LocalBackend) populatePeerStatusLocked(sb *ipnstate.StatusBuilder) {
ID: p.StableID, ID: p.StableID,
UserID: p.User, UserID: p.User,
TailscaleIPs: tailscaleIPs, TailscaleIPs: tailscaleIPs,
Tags: p.Tags,
PrimaryRoutes: p.PrimaryRoutes,
HostName: p.Hostinfo.Hostname(), HostName: p.Hostinfo.Hostname(),
DNSName: p.Name, DNSName: p.Name,
OS: p.Hostinfo.OS(), OS: p.Hostinfo.OS(),

@ -101,15 +101,23 @@ type PeerStatusLite struct {
} }
type PeerStatus struct { type PeerStatus struct {
ID tailcfg.StableNodeID ID tailcfg.StableNodeID
PublicKey key.NodePublic PublicKey key.NodePublic
HostName string // HostInfo's Hostname (not a DNS name or necessarily unique) HostName string // HostInfo's Hostname (not a DNS name or necessarily unique)
DNSName string DNSName string
OS string // HostInfo.OS OS string // HostInfo.OS
UserID tailcfg.UserID UserID tailcfg.UserID
TailscaleIPs []netaddr.IP // Tailscale IP(s) assigned to this node TailscaleIPs []netaddr.IP // Tailscale IP(s) assigned to this node
// Tags are the list of ACL tags applied to this node.
// See tailscale.com/tailcfg#Node.Tags for more information.
Tags []string `json:",omitempty"`
// PrimaryRoutes are the routes this node is currently the primary
// subnet router for, as determined by the control plane. It does
// not include the IPs in TailscaleIPs.
PrimaryRoutes []netaddr.IPPrefix `json:",omitempty"`
// Endpoints: // Endpoints:
Addrs []string Addrs []string
CurAddr string // one of Addrs, or unique if roaming CurAddr string // one of Addrs, or unique if roaming
@ -266,6 +274,12 @@ func (sb *StatusBuilder) AddPeer(peer key.NodePublic, st *PeerStatus) {
if v := st.TailscaleIPs; v != nil { if v := st.TailscaleIPs; v != nil {
e.TailscaleIPs = v e.TailscaleIPs = v
} }
if v := st.PrimaryRoutes; v != nil {
e.PrimaryRoutes = v
}
if v := st.Tags; v != nil {
e.Tags = v
}
if v := st.OS; v != "" { if v := st.OS; v != "" {
e.OS = st.OS e.OS = st.OS
} }

Loading…
Cancel
Save