Documentation
¶
Index ¶
- type LocalBackend
- func (b *LocalBackend) FakeExpireAfter(x time.Duration)
- func (b *LocalBackend) InServerMode() bool
- func (b *LocalBackend) Login(token *oauth2.Token)
- func (b *LocalBackend) Logout()
- func (b *LocalBackend) NetMap() *netmap.NetworkMap
- func (b *LocalBackend) Ping(ipStr string)
- func (b *LocalBackend) RequestEngineStatus()
- func (b *LocalBackend) RequestStatus()
- func (b *LocalBackend) SetCurrentUserID(uid string)
- func (b *LocalBackend) SetDecompressor(fn func() (controlclient.Decompressor, error))
- func (b *LocalBackend) SetPrefs(newp *ipn.Prefs)
- func (b *LocalBackend) SetWantRunning(wantRunning bool)
- func (b *LocalBackend) Shutdown()
- func (b *LocalBackend) Start(opts ipn.Options) error
- func (b *LocalBackend) StartLoginInteractive()
- func (b *LocalBackend) State() ipn.State
- func (b *LocalBackend) Status() *ipnstate.Status
- func (b *LocalBackend) TestOnlyPublicKeys() (machineKey tailcfg.MachineKey, nodeKey tailcfg.NodeKey)
- func (b *LocalBackend) UpdateStatus(sb *ipnstate.StatusBuilder)
- func (b *LocalBackend) WhoIs(ipp netaddr.IPPort) (n *tailcfg.Node, u tailcfg.UserProfile, ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalBackend ¶
type LocalBackend struct {
// contains filtered or unexported fields
}
LocalBackend is the glue between the major pieces of the Tailscale network software: the cloud control plane (via controlclient), the network data plane (via wgengine), and the user-facing UIs and CLIs (collectively called "frontends", via LocalBackend's implementation of the Backend interface).
LocalBackend implements the overall state machine for the Tailscale application. Frontends, controlclient and wgengine can feed events into LocalBackend to advance the state machine, and advancing the state machine generates events back out to zero or more components.
func NewLocalBackend ¶
func NewLocalBackend(logf logger.Logf, logid string, store ipn.StateStore, e wgengine.Engine) (*LocalBackend, error)
NewLocalBackend returns a new LocalBackend that is ready to run, but is not actually running.
func (*LocalBackend) FakeExpireAfter ¶
func (b *LocalBackend) FakeExpireAfter(x time.Duration)
FakeExpireAfter implements Backend.
func (*LocalBackend) InServerMode ¶
func (b *LocalBackend) InServerMode() bool
func (*LocalBackend) Login ¶
func (b *LocalBackend) Login(token *oauth2.Token)
Login implements Backend.
func (*LocalBackend) Logout ¶
func (b *LocalBackend) Logout()
Logout tells the controlclient that we want to log out, and transitions the local engine to the logged-out state without waiting for controlclient to be in that state.
TODO(danderson): controlclient Logout does nothing useful, and we shouldn't be transitioning to a state based on what we believe controlclient may have done.
NOTE(apenwarr): No easy way to persist logged-out status.
Maybe that's for the better; if someone logs out accidentally, rebooting will fix it.
func (*LocalBackend) NetMap ¶
func (b *LocalBackend) NetMap() *netmap.NetworkMap
NetMap returns the latest cached network map received from controlclient, or nil if no network map was received yet.
func (*LocalBackend) Ping ¶
func (b *LocalBackend) Ping(ipStr string)
func (*LocalBackend) RequestEngineStatus ¶
func (b *LocalBackend) RequestEngineStatus()
RequestEngineStatus implements Backend.
func (*LocalBackend) RequestStatus ¶
func (b *LocalBackend) RequestStatus()
RequestStatus implements Backend.
func (*LocalBackend) SetCurrentUserID ¶
func (b *LocalBackend) SetCurrentUserID(uid string)
func (*LocalBackend) SetDecompressor ¶
func (b *LocalBackend) SetDecompressor(fn func() (controlclient.Decompressor, error))
SetDecompressor sets a decompression function, which must be a zstd reader.
This exists because the iOS/Mac NetworkExtension is very resource constrained, and the zstd package is too heavy to fit in the constrained RSS limit.
func (*LocalBackend) SetPrefs ¶
func (b *LocalBackend) SetPrefs(newp *ipn.Prefs)
SetPrefs saves new user preferences and propagates them throughout the system. Implements Backend.
func (*LocalBackend) SetWantRunning ¶
func (b *LocalBackend) SetWantRunning(wantRunning bool)
func (*LocalBackend) Shutdown ¶
func (b *LocalBackend) Shutdown()
Shutdown halts the backend and all its sub-components. The backend can no longer be used after Shutdown returns.
func (*LocalBackend) Start ¶
func (b *LocalBackend) Start(opts ipn.Options) error
Start applies the configuration specified in opts, and starts the state machine.
TODO(danderson): this function is trying to do too many things at once: it loads state, or imports it, or updates prefs sometimes, contains some settings that are one-shot things done by `tailscale up` because we had nowhere else to put them, and there's no clear guarantee that switching from one user's state to another is actually a supported operation (it should be, but it's very unclear from the following whether or not that is a safe transition).
func (*LocalBackend) StartLoginInteractive ¶
func (b *LocalBackend) StartLoginInteractive()
StartLoginInteractive implements Backend. It requests a new interactive login from controlclient, unless such a flow is already in progress, in which case StartLoginInteractive attempts to pick up the in-progress flow where it left off.
func (*LocalBackend) State ¶
func (b *LocalBackend) State() ipn.State
State returns the backend state machine's current state.
func (*LocalBackend) Status ¶
func (b *LocalBackend) Status() *ipnstate.Status
Status returns the latest status of the backend and its sub-components.
func (*LocalBackend) TestOnlyPublicKeys ¶
func (b *LocalBackend) TestOnlyPublicKeys() (machineKey tailcfg.MachineKey, nodeKey tailcfg.NodeKey)
TestOnlyPublicKeys returns the current machine and node public keys. Used in tests only to facilitate automated node authorization in the test harness.
func (*LocalBackend) UpdateStatus ¶
func (b *LocalBackend) UpdateStatus(sb *ipnstate.StatusBuilder)
UpdateStatus implements ipnstate.StatusUpdater.
func (*LocalBackend) WhoIs ¶
func (b *LocalBackend) WhoIs(ipp netaddr.IPPort) (n *tailcfg.Node, u tailcfg.UserProfile, ok bool)
WhoIs reports the node and user who owns the node with the given IP:port. If the IP address is a Tailscale IP, the provided port may be 0. If ok == true, n and u are valid.