mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-21 14:11:56 +00:00
ipn/ipnstate: use key.NodePublic instead of tailcfg.NodeKey.
Updates #3206 Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
c3d7115e63
commit
c17250cee2
@ -1569,7 +1569,7 @@ func (b *LocalBackend) parseWgStatusLocked(s *wgengine.Status) (ret ipn.EngineSt
|
|||||||
fmt.Fprintf(&peerKeys, "%s ", p.NodeKey.ShortString())
|
fmt.Fprintf(&peerKeys, "%s ", p.NodeKey.ShortString())
|
||||||
|
|
||||||
ret.NumLive++
|
ret.NumLive++
|
||||||
ret.LivePeers[p.NodeKey] = p
|
ret.LivePeers[p.NodeKey.AsNodeKey()] = p
|
||||||
|
|
||||||
}
|
}
|
||||||
ret.RBytes += p.RxBytes
|
ret.RBytes += p.RxBytes
|
||||||
|
@ -90,7 +90,7 @@ func TestLocalLogLines(t *testing.T) {
|
|||||||
TxBytes: 10,
|
TxBytes: 10,
|
||||||
RxBytes: 10,
|
RxBytes: 10,
|
||||||
LastHandshake: time.Now(),
|
LastHandshake: time.Now(),
|
||||||
NodeKey: key.NewNode().Public().AsNodeKey(),
|
NodeKey: key.NewNode().Public(),
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
lb.mu.Unlock()
|
lb.mu.Unlock()
|
||||||
@ -105,7 +105,7 @@ func TestLocalLogLines(t *testing.T) {
|
|||||||
TxBytes: 11,
|
TxBytes: 11,
|
||||||
RxBytes: 12,
|
RxBytes: 12,
|
||||||
LastHandshake: time.Now(),
|
LastHandshake: time.Now(),
|
||||||
NodeKey: key.NewNode().Public().AsNodeKey(),
|
NodeKey: key.NewNode().Public(),
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
lb.mu.Unlock()
|
lb.mu.Unlock()
|
||||||
|
@ -72,7 +72,7 @@ func (s *Status) Peers() []key.NodePublic {
|
|||||||
type PeerStatusLite struct {
|
type PeerStatusLite struct {
|
||||||
TxBytes, RxBytes int64
|
TxBytes, RxBytes int64
|
||||||
LastHandshake time.Time
|
LastHandshake time.Time
|
||||||
NodeKey tailcfg.NodeKey
|
NodeKey key.NodePublic
|
||||||
}
|
}
|
||||||
|
|
||||||
type PeerStatus struct {
|
type PeerStatus struct {
|
||||||
|
@ -178,7 +178,7 @@ func (e *userspaceEngine) onOpenTimeout(flow flowtrack.Tuple) {
|
|||||||
var ps *ipnstate.PeerStatusLite
|
var ps *ipnstate.PeerStatusLite
|
||||||
if st, err := e.getStatus(); err == nil {
|
if st, err := e.getStatus(); err == nil {
|
||||||
for _, v := range st.Peers {
|
for _, v := range st.Peers {
|
||||||
if v.NodeKey == n.Key {
|
if v.NodeKey == n.Key.AsNodePublic() {
|
||||||
v := v // copy
|
v := v // copy
|
||||||
ps = &v
|
ps = &v
|
||||||
}
|
}
|
||||||
|
@ -1011,9 +1011,9 @@ func (e *userspaceEngine) getStatus() (*Status, error) {
|
|||||||
return nil, fmt.Errorf("IpcGetOperation: invalid key in line %q", line)
|
return nil, fmt.Errorf("IpcGetOperation: invalid key in line %q", line)
|
||||||
}
|
}
|
||||||
if !p.NodeKey.IsZero() {
|
if !p.NodeKey.IsZero() {
|
||||||
pp[p.NodeKey.AsNodePublic()] = p
|
pp[p.NodeKey] = p
|
||||||
}
|
}
|
||||||
p = ipnstate.PeerStatusLite{NodeKey: pk.AsNodeKey()}
|
p = ipnstate.PeerStatusLite{NodeKey: pk}
|
||||||
case "rx_bytes":
|
case "rx_bytes":
|
||||||
n, err = mem.ParseInt(v, 10, 64)
|
n, err = mem.ParseInt(v, 10, 64)
|
||||||
p.RxBytes = n
|
p.RxBytes = n
|
||||||
@ -1042,7 +1042,7 @@ func (e *userspaceEngine) getStatus() (*Status, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !p.NodeKey.IsZero() {
|
if !p.NodeKey.IsZero() {
|
||||||
pp[p.NodeKey.AsNodePublic()] = p
|
pp[p.NodeKey] = p
|
||||||
}
|
}
|
||||||
if err := <-errc; err != nil {
|
if err := <-errc; err != nil {
|
||||||
return nil, fmt.Errorf("IpcGetOperation: %v", err)
|
return nil, fmt.Errorf("IpcGetOperation: %v", err)
|
||||||
@ -1241,7 +1241,7 @@ func (e *userspaceEngine) UpdateStatus(sb *ipnstate.StatusBuilder) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, ps := range st.Peers {
|
for _, ps := range st.Peers {
|
||||||
sb.AddPeer(key.NodePublicFromRaw32(mem.B(ps.NodeKey[:])), &ipnstate.PeerStatus{
|
sb.AddPeer(ps.NodeKey, &ipnstate.PeerStatus{
|
||||||
RxBytes: int64(ps.RxBytes),
|
RxBytes: int64(ps.RxBytes),
|
||||||
TxBytes: int64(ps.TxBytes),
|
TxBytes: int64(ps.TxBytes),
|
||||||
LastHandshake: ps.LastHandshake,
|
LastHandshake: ps.LastHandshake,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user