|
|
@ -157,7 +157,6 @@ type LocalBackend struct {
|
|
|
|
notify func(ipn.Notify)
|
|
|
|
notify func(ipn.Notify)
|
|
|
|
cc controlclient.Client
|
|
|
|
cc controlclient.Client
|
|
|
|
ccAuto *controlclient.Auto // if cc is of type *controlclient.Auto
|
|
|
|
ccAuto *controlclient.Auto // if cc is of type *controlclient.Auto
|
|
|
|
inServerMode bool
|
|
|
|
|
|
|
|
machinePrivKey key.MachinePrivate
|
|
|
|
machinePrivKey key.MachinePrivate
|
|
|
|
tka *tkaState
|
|
|
|
tka *tkaState
|
|
|
|
state ipn.State
|
|
|
|
state ipn.State
|
|
|
@ -1207,10 +1206,9 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
|
|
|
|
|
|
|
|
|
|
|
|
loggedOut := prefs.LoggedOut()
|
|
|
|
loggedOut := prefs.LoggedOut()
|
|
|
|
|
|
|
|
|
|
|
|
b.inServerMode = prefs.ForceDaemon()
|
|
|
|
|
|
|
|
serverURL := prefs.ControlURLOrDefault()
|
|
|
|
serverURL := prefs.ControlURLOrDefault()
|
|
|
|
if b.inServerMode || runtime.GOOS == "windows" {
|
|
|
|
if inServerMode := prefs.ForceDaemon(); inServerMode || runtime.GOOS == "windows" {
|
|
|
|
b.logf("Start: serverMode=%v", b.inServerMode)
|
|
|
|
b.logf("Start: serverMode=%v", inServerMode)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
b.applyPrefsToHostinfoLocked(hostinfo, prefs)
|
|
|
|
b.applyPrefsToHostinfoLocked(hostinfo, prefs)
|
|
|
|
|
|
|
|
|
|
|
@ -2027,7 +2025,7 @@ func (b *LocalBackend) State() ipn.State {
|
|
|
|
func (b *LocalBackend) InServerMode() bool {
|
|
|
|
func (b *LocalBackend) InServerMode() bool {
|
|
|
|
b.mu.Lock()
|
|
|
|
b.mu.Lock()
|
|
|
|
defer b.mu.Unlock()
|
|
|
|
defer b.mu.Unlock()
|
|
|
|
return b.inServerMode
|
|
|
|
return b.pm.CurrentPrefs().ForceDaemon()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CheckIPNConnectionAllowed returns an error if the identity in ci should not
|
|
|
|
// CheckIPNConnectionAllowed returns an error if the identity in ci should not
|
|
|
@ -2045,7 +2043,7 @@ func (b *LocalBackend) CheckIPNConnectionAllowed(ci *ipnauth.ConnIdentity) error
|
|
|
|
// running as one.
|
|
|
|
// running as one.
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !b.inServerMode {
|
|
|
|
if !b.pm.CurrentPrefs().ForceDaemon() {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
uid := ci.UserID()
|
|
|
|
uid := ci.UserID()
|
|
|
@ -2431,7 +2429,6 @@ func (b *LocalBackend) setPrefsLockedOnEntry(caller string, newp *ipn.Prefs) ipn
|
|
|
|
// anyway. No-op if no exit node resolution is needed.
|
|
|
|
// anyway. No-op if no exit node resolution is needed.
|
|
|
|
findExitNodeIDLocked(newp, netMap)
|
|
|
|
findExitNodeIDLocked(newp, netMap)
|
|
|
|
// We do this to avoid holding the lock while doing everything else.
|
|
|
|
// We do this to avoid holding the lock while doing everything else.
|
|
|
|
b.inServerMode = newp.ForceDaemon
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
oldHi := b.hostinfo
|
|
|
|
oldHi := b.hostinfo
|
|
|
|
newHi := oldHi.Clone()
|
|
|
|
newHi := oldHi.Clone()
|
|
|
|