|
|
|
@ -218,20 +218,45 @@ func (b *LocalBackend) Status() *ipnstate.Status {
|
|
|
|
|
return sb.Status()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// StatusWithoutPeers is like Status but omits any details
|
|
|
|
|
// of peers.
|
|
|
|
|
func (b *LocalBackend) StatusWithoutPeers() *ipnstate.Status {
|
|
|
|
|
sb := new(ipnstate.StatusBuilder)
|
|
|
|
|
b.updateStatus(sb, nil)
|
|
|
|
|
return sb.Status()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UpdateStatus implements ipnstate.StatusUpdater.
|
|
|
|
|
func (b *LocalBackend) UpdateStatus(sb *ipnstate.StatusBuilder) {
|
|
|
|
|
b.e.UpdateStatus(sb)
|
|
|
|
|
b.updateStatus(sb, b.populatePeerStatusLocked)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// updateStatus populates sb with status.
|
|
|
|
|
//
|
|
|
|
|
// extraLocked, if non-nil, is called while b.mu is still held.
|
|
|
|
|
func (b *LocalBackend) updateStatus(sb *ipnstate.StatusBuilder, extraLocked func(*ipnstate.StatusBuilder)) {
|
|
|
|
|
b.mu.Lock()
|
|
|
|
|
defer b.mu.Unlock()
|
|
|
|
|
|
|
|
|
|
sb.SetVersion(version.Long)
|
|
|
|
|
sb.SetBackendState(b.state.String())
|
|
|
|
|
sb.SetAuthURL(b.authURL)
|
|
|
|
|
|
|
|
|
|
// TODO: hostinfo, and its networkinfo
|
|
|
|
|
// TODO: EngineStatus copy (and deprecate it?)
|
|
|
|
|
|
|
|
|
|
if b.netMap != nil {
|
|
|
|
|
sb.SetMagicDNSSuffix(b.netMap.MagicDNSSuffix())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if extraLocked != nil {
|
|
|
|
|
extraLocked(sb)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (b *LocalBackend) populatePeerStatusLocked(sb *ipnstate.StatusBuilder) {
|
|
|
|
|
if b.netMap == nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
for id, up := range b.netMap.UserProfiles {
|
|
|
|
|
sb.AddUser(id, up)
|
|
|
|
|
}
|
|
|
|
@ -264,7 +289,6 @@ func (b *LocalBackend) UpdateStatus(sb *ipnstate.StatusBuilder) {
|
|
|
|
|
ExitNode: p.StableID != "" && p.StableID == b.prefs.ExitNodeID,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WhoIs reports the node and user who owns the node with the given IP:port.
|
|
|
|
|