diff --git a/control/controlclient/client.go b/control/controlclient/client.go index 4052170d2..844f72d5e 100644 --- a/control/controlclient/client.go +++ b/control/controlclient/client.go @@ -11,7 +11,6 @@ import ( "context" - "net/http" "time" "tailscale.com/tailcfg" @@ -79,12 +78,6 @@ type Client interface { // in a separate http request. It has nothing to do with the rest of // the state machine. UpdateEndpoints(endpoints []tailcfg.Endpoint) - // SetDNS sends the SetDNSRequest request to the control plane server, - // requesting a DNS record be created or updated. - SetDNS(context.Context, *tailcfg.SetDNSRequest) error - // DoNoiseRequest sends an HTTP request to the control plane - // over the Noise transport. - DoNoiseRequest(*http.Request) (*http.Response, error) } // UserVisibleError is an error that should be shown to users. diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 4f4e9631f..a95673b25 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -138,8 +138,9 @@ type LocalBackend struct { sshServer SSHServer // or nil, initialized lazily. notify func(ipn.Notify) cc controlclient.Client - stateKey ipn.StateKey // computed in part from user-provided value - userID string // current controlling user ID (for Windows, primarily) + ccAuto *controlclient.Auto // if cc is of type *controlclient.Auto + stateKey ipn.StateKey // computed in part from user-provided value + userID string // current controlling user ID (for Windows, primarily) prefs *ipn.Prefs inServerMode bool machinePrivKey key.MachinePrivate @@ -1066,6 +1067,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error { b.mu.Lock() b.cc = cc + b.ccAuto, _ = cc.(*controlclient.Auto) endpoints := b.endpoints b.mu.Unlock() @@ -3199,7 +3201,7 @@ func (b *LocalBackend) SetDNS(ctx context.Context, name, value string) error { } b.mu.Lock() - cc := b.cc + cc := b.ccAuto if prefs := b.prefs; prefs != nil { req.NodeKey = prefs.Persist.PrivateNodeKey.Public() } @@ -3427,7 +3429,7 @@ func (b *LocalBackend) magicConn() (*magicsock.Conn, error) { // Noise connection. func (b *LocalBackend) DoNoiseRequest(req *http.Request) (*http.Response, error) { b.mu.Lock() - cc := b.cc + cc := b.ccAuto b.mu.Unlock() if cc == nil { return nil, errors.New("no client") diff --git a/ipn/ipnlocal/state_test.go b/ipn/ipnlocal/state_test.go index bc6cfd3c4..ddd60a401 100644 --- a/ipn/ipnlocal/state_test.go +++ b/ipn/ipnlocal/state_test.go @@ -6,7 +6,6 @@ import ( "context" - "net/http" "sync" "testing" "time" @@ -264,14 +263,6 @@ func (cc *mockControl) UpdateEndpoints(endpoints []tailcfg.Endpoint) { cc.called("UpdateEndpoints") } -func (*mockControl) SetDNS(context.Context, *tailcfg.SetDNSRequest) error { - panic("unexpected SetDNS call") -} - -func (*mockControl) DoNoiseRequest(*http.Request) (*http.Response, error) { - panic("unexpected DoNoiseRequest call") -} - // A very precise test of the sequence of function calls generated by // ipnlocal.Local into its controlclient instance, and the events it // produces upstream into the UI.