mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-20 13:41:41 +00:00
control/controlclient: document a few things
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
cf2beafbcd
commit
ddaacf0a57
@ -404,7 +404,7 @@ func (c *Client) authRoutine() {
|
|||||||
continue
|
continue
|
||||||
} else if url != "" {
|
} else if url != "" {
|
||||||
if goal.url != "" {
|
if goal.url != "" {
|
||||||
err = fmt.Errorf("weird: server required a new url?")
|
err = fmt.Errorf("[unexpected] server required a new URL?")
|
||||||
report(err, "WaitLoginURL")
|
report(err, "WaitLoginURL")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,6 +590,7 @@ func (c *Client) AuthCantContinue() bool {
|
|||||||
return !c.loggedIn && (c.loginGoal == nil || c.loginGoal.url != "")
|
return !c.loggedIn && (c.loginGoal == nil || c.loginGoal.url != "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetStatusFunc sets fn as the callback to run on any status change.
|
||||||
func (c *Client) SetStatusFunc(fn func(Status)) {
|
func (c *Client) SetStatusFunc(fn func(Status)) {
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
c.statusFunc = fn
|
c.statusFunc = fn
|
||||||
@ -693,6 +694,13 @@ func (c *Client) Logout() {
|
|||||||
c.cancelAuth()
|
c.cancelAuth()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateEndpoints sets the client's discovered endpoints and sends
|
||||||
|
// them to the control server if they've changed.
|
||||||
|
//
|
||||||
|
// It does not retain the provided slice.
|
||||||
|
//
|
||||||
|
// The localPort field is unused except for integration tests in
|
||||||
|
// another repo.
|
||||||
func (c *Client) UpdateEndpoints(localPort uint16, endpoints []string) {
|
func (c *Client) UpdateEndpoints(localPort uint16, endpoints []string) {
|
||||||
changed := c.direct.SetEndpoints(localPort, endpoints)
|
changed := c.direct.SetEndpoints(localPort, endpoints)
|
||||||
if changed {
|
if changed {
|
||||||
|
@ -270,12 +270,15 @@ func (c *Direct) TryLogin(ctx context.Context, t *tailcfg.Oauth2Token, flags Log
|
|||||||
return c.doLoginOrRegen(ctx, t, flags, false, "")
|
return c.doLoginOrRegen(ctx, t, flags, false, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Direct) WaitLoginURL(ctx context.Context, url string) (newUrl string, err error) {
|
// WaitLoginURL sits in a long poll waiting for the user to authenticate at url.
|
||||||
|
//
|
||||||
|
// On success, newURL and err will both be nil.
|
||||||
|
func (c *Direct) WaitLoginURL(ctx context.Context, url string) (newURL string, err error) {
|
||||||
c.logf("direct.WaitLoginURL")
|
c.logf("direct.WaitLoginURL")
|
||||||
return c.doLoginOrRegen(ctx, nil, LoginDefault, false, url)
|
return c.doLoginOrRegen(ctx, nil, LoginDefault, false, url)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Direct) doLoginOrRegen(ctx context.Context, t *tailcfg.Oauth2Token, flags LoginFlags, regen bool, url string) (newUrl string, err error) {
|
func (c *Direct) doLoginOrRegen(ctx context.Context, t *tailcfg.Oauth2Token, flags LoginFlags, regen bool, url string) (newURL string, err error) {
|
||||||
mustregen, url, err := c.doLogin(ctx, t, flags, regen, url)
|
mustregen, url, err := c.doLogin(ctx, t, flags, regen, url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return url, err
|
return url, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user