mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
ipn/ipnlocal: fix tailscale status --json AuthURL field
It was getting cleared on notify. Document that authURL is cleared on notify and add a new field that isn't, using the new field for the JSON status. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
09891b9868
commit
2f17a34242
@ -114,7 +114,8 @@ type LocalBackend struct {
|
|||||||
engineStatus ipn.EngineStatus
|
engineStatus ipn.EngineStatus
|
||||||
endpoints []tailcfg.Endpoint
|
endpoints []tailcfg.Endpoint
|
||||||
blocked bool
|
blocked bool
|
||||||
authURL string
|
authURL string // cleared on Notify
|
||||||
|
authURLSticky string // not cleared on Notify
|
||||||
interact bool
|
interact bool
|
||||||
prevIfState *interfaces.State
|
prevIfState *interfaces.State
|
||||||
peerAPIServer *peerAPIServer // or nil
|
peerAPIServer *peerAPIServer // or nil
|
||||||
@ -310,7 +311,7 @@ func (b *LocalBackend) updateStatus(sb *ipnstate.StatusBuilder, extraLocked func
|
|||||||
sb.MutateStatus(func(s *ipnstate.Status) {
|
sb.MutateStatus(func(s *ipnstate.Status) {
|
||||||
s.Version = version.Long
|
s.Version = version.Long
|
||||||
s.BackendState = b.state.String()
|
s.BackendState = b.state.String()
|
||||||
s.AuthURL = b.authURL
|
s.AuthURL = b.authURLSticky
|
||||||
if b.netMap != nil {
|
if b.netMap != nil {
|
||||||
s.MagicDNSSuffix = b.netMap.MagicDNSSuffix()
|
s.MagicDNSSuffix = b.netMap.MagicDNSSuffix()
|
||||||
}
|
}
|
||||||
@ -460,6 +461,7 @@ func (b *LocalBackend) setClientStatus(st controlclient.Status) {
|
|||||||
}
|
}
|
||||||
if st.URL != "" {
|
if st.URL != "" {
|
||||||
b.authURL = st.URL
|
b.authURL = st.URL
|
||||||
|
b.authURLSticky = st.URL
|
||||||
}
|
}
|
||||||
if b.state == ipn.NeedsLogin {
|
if b.state == ipn.NeedsLogin {
|
||||||
if !b.prefs.WantRunning {
|
if !b.prefs.WantRunning {
|
||||||
@ -1031,7 +1033,7 @@ func (b *LocalBackend) popBrowserAuthNow() {
|
|||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
url := b.authURL
|
url := b.authURL
|
||||||
b.interact = false
|
b.interact = false
|
||||||
b.authURL = ""
|
b.authURL = "" // but NOT clearing authURLSticky
|
||||||
b.mu.Unlock()
|
b.mu.Unlock()
|
||||||
|
|
||||||
b.logf("popBrowserAuthNow: url=%v", url != "")
|
b.logf("popBrowserAuthNow: url=%v", url != "")
|
||||||
@ -1965,6 +1967,10 @@ func (b *LocalBackend) enterState(newState ipn.State) {
|
|||||||
networkUp := b.prevIfState.AnyInterfaceUp()
|
networkUp := b.prevIfState.AnyInterfaceUp()
|
||||||
activeLogin := b.activeLogin
|
activeLogin := b.activeLogin
|
||||||
authURL := b.authURL
|
authURL := b.authURL
|
||||||
|
if newState == ipn.Running {
|
||||||
|
b.authURL = ""
|
||||||
|
b.authURLSticky = ""
|
||||||
|
}
|
||||||
b.mu.Unlock()
|
b.mu.Unlock()
|
||||||
|
|
||||||
if state == newState {
|
if state == newState {
|
||||||
@ -2116,6 +2122,7 @@ func (b *LocalBackend) ResetForClientDisconnect() {
|
|||||||
b.setNetMapLocked(nil)
|
b.setNetMapLocked(nil)
|
||||||
b.prefs = new(ipn.Prefs)
|
b.prefs = new(ipn.Prefs)
|
||||||
b.authURL = ""
|
b.authURL = ""
|
||||||
|
b.authURLSticky = ""
|
||||||
b.activeLogin = ""
|
b.activeLogin = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user