ipn: re-run go generate, fix build

Broken by #6546

Change-Id: I61194dec13a5565628ad68f7bb19ba861348dfe2
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2022-11-29 10:58:01 -08:00
parent f1130421f0
commit a94073c985
No known key found for this signature in database
4 changed files with 12 additions and 21 deletions

View File

@ -24,10 +24,7 @@ func (src *Prefs) Clone() *Prefs {
*dst = *src *dst = *src
dst.AdvertiseTags = append(src.AdvertiseTags[:0:0], src.AdvertiseTags...) dst.AdvertiseTags = append(src.AdvertiseTags[:0:0], src.AdvertiseTags...)
dst.AdvertiseRoutes = append(src.AdvertiseRoutes[:0:0], src.AdvertiseRoutes...) dst.AdvertiseRoutes = append(src.AdvertiseRoutes[:0:0], src.AdvertiseRoutes...)
if dst.Persist != nil { dst.Persist = src.Persist.Clone()
dst.Persist = new(persist.Persist)
*dst.Persist = *src.Persist
}
return dst return dst
} }

View File

@ -87,13 +87,7 @@ func (v PrefsView) NoSNAT() bool { return v.ж.NoSNAT }
func (v PrefsView) NetfilterMode() preftype.NetfilterMode { return v.ж.NetfilterMode } func (v PrefsView) NetfilterMode() preftype.NetfilterMode { return v.ж.NetfilterMode }
func (v PrefsView) OperatorUser() string { return v.ж.OperatorUser } func (v PrefsView) OperatorUser() string { return v.ж.OperatorUser }
func (v PrefsView) ProfileName() string { return v.ж.ProfileName } func (v PrefsView) ProfileName() string { return v.ж.ProfileName }
func (v PrefsView) Persist() *persist.Persist { func (v PrefsView) Persist() persist.PersistView { return v.ж.Persist.View() }
if v.ж.Persist == nil {
return nil
}
x := *v.ж.Persist
return &x
}
// A compilation failure here means this code must be regenerated, with the command at the top of this file. // A compilation failure here means this code must be regenerated, with the command at the top of this file.
var _PrefsViewNeedsRegeneration = Prefs(struct { var _PrefsViewNeedsRegeneration = Prefs(struct {

View File

@ -517,7 +517,7 @@ func (b *LocalBackend) Shutdown() {
} }
func stripKeysFromPrefs(p ipn.PrefsView) ipn.PrefsView { func stripKeysFromPrefs(p ipn.PrefsView) ipn.PrefsView {
if !p.Valid() || p.Persist() == nil { if !p.Valid() || !p.Persist().Valid() {
return p return p
} }
@ -816,7 +816,7 @@ func (b *LocalBackend) setClientStatus(st controlclient.Status) {
b.mu.Lock() b.mu.Lock()
if st.LogoutFinished != nil { if st.LogoutFinished != nil {
if p := b.pm.CurrentPrefs(); p.Persist() == nil || p.Persist().LoginName == "" { if p := b.pm.CurrentPrefs(); !p.Persist().Valid() || p.Persist().LoginName() == "" {
b.mu.Unlock() b.mu.Unlock()
return return
} }
@ -1203,7 +1203,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
if opts.UpdatePrefs != nil { if opts.UpdatePrefs != nil {
oldPrefs := b.pm.CurrentPrefs() oldPrefs := b.pm.CurrentPrefs()
newPrefs := opts.UpdatePrefs.Clone() newPrefs := opts.UpdatePrefs.Clone()
newPrefs.Persist = oldPrefs.Persist() newPrefs.Persist = oldPrefs.Persist().AsStruct()
pv := newPrefs.View() pv := newPrefs.View()
if err := b.pm.SetPrefs(pv); err != nil { if err := b.pm.SetPrefs(pv); err != nil {
b.logf("failed to save UpdatePrefs state: %v", err) b.logf("failed to save UpdatePrefs state: %v", err)
@ -1228,7 +1228,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
b.applyPrefsToHostinfoLocked(hostinfo, prefs) b.applyPrefsToHostinfoLocked(hostinfo, prefs)
b.setNetMapLocked(nil) b.setNetMapLocked(nil)
persistv := prefs.Persist() persistv := prefs.Persist().AsStruct()
if persistv == nil { if persistv == nil {
persistv = new(persist.Persist) persistv = new(persist.Persist)
} }
@ -1947,8 +1947,8 @@ func (b *LocalBackend) initMachineKeyLocked() (err error) {
} }
var legacyMachineKey key.MachinePrivate var legacyMachineKey key.MachinePrivate
if p := b.pm.CurrentPrefs().Persist(); p != nil { if p := b.pm.CurrentPrefs().Persist(); p.Valid() {
legacyMachineKey = p.LegacyFrontendPrivateMachineKey legacyMachineKey = p.LegacyFrontendPrivateMachineKey()
} }
keyText, err := b.store.ReadState(ipn.MachineKeyStateKey) keyText, err := b.store.ReadState(ipn.MachineKeyStateKey)
@ -2481,7 +2481,7 @@ func (b *LocalBackend) setPrefsLockedOnEntry(caller string, newp *ipn.Prefs) ipn
oldp := b.pm.CurrentPrefs() oldp := b.pm.CurrentPrefs()
if oldp.Valid() { if oldp.Valid() {
newp.Persist = oldp.Persist().Clone() // caller isn't allowed to override this newp.Persist = oldp.Persist().AsStruct() // caller isn't allowed to override this
} }
// findExitNodeIDLocked returns whether it updated b.prefs, but // findExitNodeIDLocked returns whether it updated b.prefs, but
// everything in this function treats b.prefs as completely new // everything in this function treats b.prefs as completely new
@ -3338,7 +3338,7 @@ func (b *LocalBackend) hasNodeKey() bool {
b.mu.Lock() b.mu.Lock()
defer b.mu.Unlock() defer b.mu.Unlock()
p := b.pm.CurrentPrefs() p := b.pm.CurrentPrefs()
return p.Valid() && p.Persist() != nil && !p.Persist().PrivateNodeKey.IsZero() return p.Valid() && p.Persist().Valid() && !p.Persist().PrivateNodeKey().IsZero()
} }
// nextState returns the state the backend seems to be in, based on // nextState returns the state the backend seems to be in, based on
@ -3927,7 +3927,7 @@ func (b *LocalBackend) SetDNS(ctx context.Context, name, value string) error {
b.mu.Lock() b.mu.Lock()
cc := b.ccAuto cc := b.ccAuto
if prefs := b.pm.CurrentPrefs(); prefs.Valid() { if prefs := b.pm.CurrentPrefs(); prefs.Valid() {
req.NodeKey = prefs.Persist().PrivateNodeKey.Public() req.NodeKey = prefs.Persist().PrivateNodeKey().Public()
} }
b.mu.Unlock() b.mu.Unlock()
if cc == nil { if cc == nil {

View File

@ -45,7 +45,7 @@ type Persist struct {
// this node will not operate network lock on. This is used to // this node will not operate network lock on. This is used to
// prevent bootstrapping TKA onto a key authority which was forcibly // prevent bootstrapping TKA onto a key authority which was forcibly
// disabled. // disabled.
DisallowedTKAStateIDs []string DisallowedTKAStateIDs []string `json:",omitempty"`
} }
// PublicNodeKey returns the public key for the node key. // PublicNodeKey returns the public key for the node key.