mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-07 16:54:37 +00:00
control/controlclient, ipn/ipnlocal: remove some Client methods
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
a1e429f7c3
commit
70a2797064
@ -11,7 +11,6 @@ package controlclient
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"tailscale.com/tailcfg"
|
"tailscale.com/tailcfg"
|
||||||
@ -79,12 +78,6 @@ type Client interface {
|
|||||||
// in a separate http request. It has nothing to do with the rest of
|
// in a separate http request. It has nothing to do with the rest of
|
||||||
// the state machine.
|
// the state machine.
|
||||||
UpdateEndpoints(endpoints []tailcfg.Endpoint)
|
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.
|
// UserVisibleError is an error that should be shown to users.
|
||||||
|
@ -138,6 +138,7 @@ type LocalBackend struct {
|
|||||||
sshServer SSHServer // or nil, initialized lazily.
|
sshServer SSHServer // or nil, initialized lazily.
|
||||||
notify func(ipn.Notify)
|
notify func(ipn.Notify)
|
||||||
cc controlclient.Client
|
cc controlclient.Client
|
||||||
|
ccAuto *controlclient.Auto // if cc is of type *controlclient.Auto
|
||||||
stateKey ipn.StateKey // computed in part from user-provided value
|
stateKey ipn.StateKey // computed in part from user-provided value
|
||||||
userID string // current controlling user ID (for Windows, primarily)
|
userID string // current controlling user ID (for Windows, primarily)
|
||||||
prefs *ipn.Prefs
|
prefs *ipn.Prefs
|
||||||
@ -1066,6 +1067,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
|
|||||||
|
|
||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
b.cc = cc
|
b.cc = cc
|
||||||
|
b.ccAuto, _ = cc.(*controlclient.Auto)
|
||||||
endpoints := b.endpoints
|
endpoints := b.endpoints
|
||||||
b.mu.Unlock()
|
b.mu.Unlock()
|
||||||
|
|
||||||
@ -3199,7 +3201,7 @@ func (b *LocalBackend) SetDNS(ctx context.Context, name, value string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
cc := b.cc
|
cc := b.ccAuto
|
||||||
if prefs := b.prefs; prefs != nil {
|
if prefs := b.prefs; prefs != nil {
|
||||||
req.NodeKey = prefs.Persist.PrivateNodeKey.Public()
|
req.NodeKey = prefs.Persist.PrivateNodeKey.Public()
|
||||||
}
|
}
|
||||||
@ -3427,7 +3429,7 @@ func (b *LocalBackend) magicConn() (*magicsock.Conn, error) {
|
|||||||
// Noise connection.
|
// Noise connection.
|
||||||
func (b *LocalBackend) DoNoiseRequest(req *http.Request) (*http.Response, error) {
|
func (b *LocalBackend) DoNoiseRequest(req *http.Request) (*http.Response, error) {
|
||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
cc := b.cc
|
cc := b.ccAuto
|
||||||
b.mu.Unlock()
|
b.mu.Unlock()
|
||||||
if cc == nil {
|
if cc == nil {
|
||||||
return nil, errors.New("no client")
|
return nil, errors.New("no client")
|
||||||
|
@ -6,7 +6,6 @@ package ipnlocal
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -264,14 +263,6 @@ func (cc *mockControl) UpdateEndpoints(endpoints []tailcfg.Endpoint) {
|
|||||||
cc.called("UpdateEndpoints")
|
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
|
// A very precise test of the sequence of function calls generated by
|
||||||
// ipnlocal.Local into its controlclient instance, and the events it
|
// ipnlocal.Local into its controlclient instance, and the events it
|
||||||
// produces upstream into the UI.
|
// produces upstream into the UI.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user