wgengine, ipn: include number of active DERPs in status

Use this when making the ipn state transition from Starting to
Running. This way a network of quiet nodes with no active
handshaking will still transition to Active.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
David Crawshaw
2020-03-19 17:55:14 +11:00
parent 1ad78ce698
commit addbdce296
5 changed files with 13 additions and 1 deletions
+8
View File
@@ -1080,6 +1080,14 @@ func (c *Conn) cleanStaleDerp() {
}
}
// DERPs reports the number of active DERP connections.
func (c *Conn) DERPs() int {
c.mu.Lock()
defer c.mu.Unlock()
return len(c.activeDerp)
}
func (c *Conn) SetMark(value uint32) error { return nil }
func (c *Conn) LastMark() uint32 { return 0 }
+1
View File
@@ -530,6 +530,7 @@ func (e *userspaceEngine) getStatus() (*Status, error) {
return &Status{
LocalAddrs: append([]string(nil), e.endpoints...),
Peers: peers,
DERPs: e.magicConn.DERPs(),
}, nil
}
+1
View File
@@ -32,6 +32,7 @@ type PeerStatus struct {
type Status struct {
Peers []PeerStatus
LocalAddrs []string // TODO(crawshaw): []wgcfg.Endpoint?
DERPs int // number of active DERP connections
}
// StatusCallback is the type of status callbacks used by