mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-16 03:31:39 +00:00
ipn/ipnlocal: populate self status from netmap in ipnlocal, not magicsock.
Fixes #1933 Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
e121c2f724
commit
33c541ae30
@ -350,8 +350,18 @@ func (b *LocalBackend) updateStatus(sb *ipnstate.StatusBuilder, extraLocked func
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
sb.MutateSelfStatus(func(ss *ipnstate.PeerStatus) {
|
sb.MutateSelfStatus(func(ss *ipnstate.PeerStatus) {
|
||||||
if b.netMap != nil && b.netMap.SelfNode != nil {
|
if b.netMap != nil {
|
||||||
ss.ID = b.netMap.SelfNode.StableID
|
ss.HostName = b.netMap.Hostinfo.Hostname
|
||||||
|
ss.DNSName = b.netMap.Name
|
||||||
|
ss.UserID = b.netMap.User
|
||||||
|
if sn := b.netMap.SelfNode; sn != nil {
|
||||||
|
ss.ID = sn.StableID
|
||||||
|
if c := sn.Capabilities; len(c) > 0 {
|
||||||
|
ss.Capabilities = append([]string(nil), c...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ss.HostName, _ = os.Hostname()
|
||||||
}
|
}
|
||||||
for _, pln := range b.peerAPIListeners {
|
for _, pln := range b.peerAPIListeners {
|
||||||
ss.PeerAPIURL = append(ss.PeerAPIURL, pln.urlStr)
|
ss.PeerAPIURL = append(ss.PeerAPIURL, pln.urlStr)
|
||||||
|
@ -17,7 +17,6 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
@ -3129,18 +3128,6 @@ func (c *Conn) UpdateStatus(sb *ipnstate.StatusBuilder) {
|
|||||||
ss.Addrs = append(ss.Addrs, ep.Addr.String())
|
ss.Addrs = append(ss.Addrs, ep.Addr.String())
|
||||||
}
|
}
|
||||||
ss.OS = version.OS()
|
ss.OS = version.OS()
|
||||||
if c.netMap != nil {
|
|
||||||
ss.HostName = c.netMap.Hostinfo.Hostname
|
|
||||||
ss.DNSName = c.netMap.Name
|
|
||||||
ss.UserID = c.netMap.User
|
|
||||||
if c.netMap.SelfNode != nil {
|
|
||||||
if c := c.netMap.SelfNode.Capabilities; len(c) > 0 {
|
|
||||||
ss.Capabilities = append([]string(nil), c...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ss.HostName, _ = os.Hostname()
|
|
||||||
}
|
|
||||||
if c.derpMap != nil {
|
if c.derpMap != nil {
|
||||||
derpRegion, ok := c.derpMap.Regions[c.myDerp]
|
derpRegion, ok := c.derpMap.Regions[c.myDerp]
|
||||||
if ok {
|
if ok {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user