mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
ipn: use key.NodePublic instead of tailcfg.NodeKey
Updates #3206 Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
c17250cee2
commit
7e8d5ed6f3
@ -12,6 +12,7 @@ import (
|
|||||||
"tailscale.com/ipn/ipnstate"
|
"tailscale.com/ipn/ipnstate"
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
"tailscale.com/types/empty"
|
"tailscale.com/types/empty"
|
||||||
|
"tailscale.com/types/key"
|
||||||
"tailscale.com/types/netmap"
|
"tailscale.com/types/netmap"
|
||||||
"tailscale.com/types/structs"
|
"tailscale.com/types/structs"
|
||||||
)
|
)
|
||||||
@ -48,7 +49,7 @@ type EngineStatus struct {
|
|||||||
RBytes, WBytes int64
|
RBytes, WBytes int64
|
||||||
NumLive int
|
NumLive int
|
||||||
LiveDERPs int // number of active DERP connections
|
LiveDERPs int // number of active DERP connections
|
||||||
LivePeers map[tailcfg.NodeKey]ipnstate.PeerStatusLite
|
LivePeers map[key.NodePublic]ipnstate.PeerStatusLite
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify is a communication from a backend (e.g. tailscaled) to a frontend
|
// Notify is a communication from a backend (e.g. tailscaled) to a frontend
|
||||||
|
@ -1562,14 +1562,14 @@ func (b *LocalBackend) parseWgStatusLocked(s *wgengine.Status) (ret ipn.EngineSt
|
|||||||
var peerStats, peerKeys strings.Builder
|
var peerStats, peerKeys strings.Builder
|
||||||
|
|
||||||
ret.LiveDERPs = s.DERPs
|
ret.LiveDERPs = s.DERPs
|
||||||
ret.LivePeers = map[tailcfg.NodeKey]ipnstate.PeerStatusLite{}
|
ret.LivePeers = map[key.NodePublic]ipnstate.PeerStatusLite{}
|
||||||
for _, p := range s.Peers {
|
for _, p := range s.Peers {
|
||||||
if !p.LastHandshake.IsZero() {
|
if !p.LastHandshake.IsZero() {
|
||||||
fmt.Fprintf(&peerStats, "%d/%d ", p.RxBytes, p.TxBytes)
|
fmt.Fprintf(&peerStats, "%d/%d ", p.RxBytes, p.TxBytes)
|
||||||
fmt.Fprintf(&peerKeys, "%s ", p.NodeKey.ShortString())
|
fmt.Fprintf(&peerKeys, "%s ", p.NodeKey.ShortString())
|
||||||
|
|
||||||
ret.NumLive++
|
ret.NumLive++
|
||||||
ret.LivePeers[p.NodeKey.AsNodeKey()] = p
|
ret.LivePeers[p.NodeKey] = p
|
||||||
|
|
||||||
}
|
}
|
||||||
ret.RBytes += p.RxBytes
|
ret.RBytes += p.RxBytes
|
||||||
@ -2680,7 +2680,7 @@ func (b *LocalBackend) OperatorUserID() string {
|
|||||||
// TestOnlyPublicKeys returns the current machine and node public
|
// TestOnlyPublicKeys returns the current machine and node public
|
||||||
// keys. Used in tests only to facilitate automated node authorization
|
// keys. Used in tests only to facilitate automated node authorization
|
||||||
// in the test harness.
|
// in the test harness.
|
||||||
func (b *LocalBackend) TestOnlyPublicKeys() (machineKey key.MachinePublic, nodeKey tailcfg.NodeKey) {
|
func (b *LocalBackend) TestOnlyPublicKeys() (machineKey key.MachinePublic, nodeKey key.NodePublic) {
|
||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
prefs := b.prefs
|
prefs := b.prefs
|
||||||
machinePrivKey := b.machinePrivKey
|
machinePrivKey := b.machinePrivKey
|
||||||
@ -2692,7 +2692,7 @@ func (b *LocalBackend) TestOnlyPublicKeys() (machineKey key.MachinePublic, nodeK
|
|||||||
|
|
||||||
mk := machinePrivKey.Public()
|
mk := machinePrivKey.Public()
|
||||||
nk := prefs.Persist.PrivateNodeKey.Public()
|
nk := prefs.Persist.PrivateNodeKey.Public()
|
||||||
return mk, nk.AsNodeKey()
|
return mk, nk
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *LocalBackend) WaitingFiles() ([]apitype.WaitingFile, error) {
|
func (b *LocalBackend) WaitingFiles() ([]apitype.WaitingFile, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user