types/persist: add PublicNodeKey helper

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2022-10-23 07:48:12 +00:00
committed by Maisem Ali
parent 0957bc5af2
commit a2d15924fb
4 changed files with 12 additions and 7 deletions

View File

@@ -3396,7 +3396,7 @@ func (b *LocalBackend) TestOnlyPublicKeys() (machineKey key.MachinePublic, nodeK
}
mk := machinePrivKey.Public()
nk := prefs.Persist().PrivateNodeKey.Public()
nk := prefs.Persist().PublicNodeKey()
return mk, nk
}
@@ -3506,7 +3506,7 @@ func (b *LocalBackend) SetDNS(ctx context.Context, name, value string) error {
b.mu.Lock()
cc := b.ccAuto
if b.prefs.Valid() {
req.NodeKey = b.prefs.Persist().PrivateNodeKey.Public()
req.NodeKey = b.prefs.Persist().PublicNodeKey()
}
b.mu.Unlock()
if cc == nil {

View File

@@ -100,7 +100,7 @@ func (b *LocalBackend) tkaSyncIfNeeded(nm *netmap.NetworkMap) error {
b.mu.Lock() // take mu to protect access to synchronized fields.
defer b.mu.Unlock()
ourNodeKey := b.prefs.Persist().PrivateNodeKey.Public()
ourNodeKey := b.prefs.Persist().PublicNodeKey()
isEnabled := b.tka != nil
wantEnabled := nm.TKAEnabled
@@ -342,7 +342,7 @@ func (b *LocalBackend) NetworkLockInit(keys []tka.Key) error {
var ourNodeKey key.NodePublic
b.mu.Lock()
if b.prefs.Valid() {
ourNodeKey = b.prefs.Persist().PrivateNodeKey.Public()
ourNodeKey = b.prefs.Persist().PublicNodeKey()
}
b.mu.Unlock()
if ourNodeKey.IsZero() {
@@ -453,7 +453,7 @@ func (b *LocalBackend) NetworkLockModify(addKeys, removeKeys []tka.Key) (err err
return nil
}
ourNodeKey := b.prefs.Persist().PrivateNodeKey.Public()
ourNodeKey := b.prefs.Persist().PublicNodeKey()
b.mu.Unlock()
resp, err := b.tkaDoSyncSend(ourNodeKey, aums, true)
b.mu.Lock()