local
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package local contains a Go client for the Tailscale LocalAPI.
Index¶
- Variables
- func CertPair(ctx context.Context, domain string) (certPEM, keyPEM []byte, err error)deprecated
- func ExpandSNIName(ctx context.Context, name string) (fqdn string, ok bool)deprecated
- func GetCertificate(hi *tls.ClientHelloInfo) (*tls.Certificate, error)deprecated
- func IsAccessDeniedError(err error) bool
- func IsPreconditionsFailedError(err error) bool
- func SetVersionMismatchHandler(f func(clientVer, serverVer string))
- func Status(ctx context.Context) (*ipnstate.Status, error)
- func StatusWithoutPeers(ctx context.Context) (*ipnstate.Status, error)
- func WhoIs(ctx context.Context, remoteAddr string) (*apitype.WhoIsResponse, error)deprecated
- type AccessDeniedError
- type BugReportOpts
- type Client
- func (lc *Client) AwaitWaitingFiles(ctx context.Context, d time.Duration) ([]apitype.WaitingFile, error)
- func (lc *Client) BugReport(ctx context.Context, note string) (string, error)
- func (lc *Client) BugReportWithOpts(ctx context.Context, opts BugReportOpts) (string, error)
- func (lc *Client) CertPair(ctx context.Context, domain string) (certPEM, keyPEM []byte, err error)
- func (lc *Client) CertPairWithValidity(ctx context.Context, domain string, minValidity time.Duration) (certPEM, keyPEM []byte, err error)
- func (lc *Client) CheckIPForwarding(ctx context.Context) error
- func (lc *Client) CheckPrefs(ctx context.Context, p *ipn.Prefs) error
- func (lc *Client) CheckReversePathFiltering(ctx context.Context) error
- func (lc *Client) CheckSOMarkInUse(ctx context.Context) (bool, error)
- func (lc *Client) CheckUDPGROForwarding(ctx context.Context) error
- func (lc *Client) CheckUpdate(ctx context.Context) (*tailcfg.ClientVersion, error)
- func (lc *Client) CurrentDERPMap(ctx context.Context) (*tailcfg.DERPMap, error)
- func (lc *Client) DaemonMetrics(ctx context.Context) ([]byte, error)
- func (lc *Client) DebugAction(ctx context.Context, action string) error
- func (lc *Client) DebugActionBody(ctx context.Context, action string, rbody io.Reader) error
- func (lc *Client) DebugDERPRegion(ctx context.Context, regionIDOrCode string) (*ipnstate.DebugDERPRegionReport, error)
- func (lc *Client) DebugPacketFilterRules(ctx context.Context) ([]tailcfg.FilterRule, error)
- func (lc *Client) DebugPeerRelaySessions(ctx context.Context) (*status.ServerStatus, error)
- func (lc *Client) DebugPortmap(ctx context.Context, opts *DebugPortmapOpts) (io.ReadCloser, error)
- func (lc *Client) DebugResultJSON(ctx context.Context, action string) (any, error)
- func (lc *Client) DebugSetExpireIn(ctx context.Context, d time.Duration) error
- func (lc *Client) DeleteProfile(ctx context.Context, profile ipn.ProfileID) error
- func (lc *Client) DeleteWaitingFile(ctx context.Context, baseName string) error
- func (lc *Client) DialTCP(ctx context.Context, host string, port uint16) (net.Conn, error)
- func (lc *Client) DisconnectControl(ctx context.Context) error
- func (lc *Client) DoLocalRequest(req *http.Request) (*http.Response, error)
- func (lc *Client) DriveSetServerAddr(ctx context.Context, addr string) error
- func (lc *Client) DriveShareList(ctx context.Context) ([]*drive.Share, error)
- func (lc *Client) DriveShareRemove(ctx context.Context, name string) error
- func (lc *Client) DriveShareRename(ctx context.Context, oldName, newName string) error
- func (lc *Client) DriveShareSet(ctx context.Context, share *drive.Share) error
- func (lc *Client) EditPrefs(ctx context.Context, mp *ipn.MaskedPrefs) (*ipn.Prefs, error)
- func (lc *Client) EventBusGraph(ctx context.Context) ([]byte, error)
- func (lc *Client) ExpandSNIName(ctx context.Context, name string) (fqdn string, ok bool)
- func (lc *Client) FileTargets(ctx context.Context) ([]apitype.FileTarget, error)
- func (lc *Client) GetAppConnectorRouteInfo(ctx context.Context) (appctype.RouteInfo, error)
- func (lc *Client) GetCertificate(hi *tls.ClientHelloInfo) (*tls.Certificate, error)
- func (lc *Client) GetDNSOSConfig(ctx context.Context) (*apitype.DNSOSConfig, error)
- func (lc *Client) GetEffectivePolicy(ctx context.Context, scope setting.PolicyScope) (*setting.Snapshot, error)
- func (lc *Client) GetPrefs(ctx context.Context) (*ipn.Prefs, error)
- func (lc *Client) GetServeConfig(ctx context.Context) (*ipn.ServeConfig, error)
- func (lc *Client) GetWaitingFile(ctx context.Context, baseName string) (rc io.ReadCloser, size int64, err error)
- func (lc *Client) Goroutines(ctx context.Context) ([]byte, error)
- func (lc *Client) IDToken(ctx context.Context, aud string) (*tailcfg.TokenResponse, error)
- func (lc *Client) IncrementCounter(ctx context.Context, name string, delta int) error
- func (lc *Client) IncrementGauge(ctx context.Context, name string, delta int) error
- func (lc *Client) Logout(ctx context.Context) error
- func (lc *Client) NetworkLockAffectedSigs(ctx context.Context, keyID tkatype.KeyID) ([]tkatype.MarshaledSignature, error)
- func (lc *Client) NetworkLockCosignRecoveryAUM(ctx context.Context, aum tka.AUM) ([]byte, error)
- func (lc *Client) NetworkLockDisable(ctx context.Context, secret []byte) error
- func (lc *Client) NetworkLockForceLocalDisable(ctx context.Context) error
- func (lc *Client) NetworkLockGenRecoveryAUM(ctx context.Context, removeKeys []tkatype.KeyID, forkFrom tka.AUMHash) ([]byte, error)
- func (lc *Client) NetworkLockInit(ctx context.Context, keys []tka.Key, disablementValues [][]byte, ...) (*ipnstate.NetworkLockStatus, error)
- func (lc *Client) NetworkLockLog(ctx context.Context, maxEntries int) ([]ipnstate.NetworkLockUpdate, error)
- func (lc *Client) NetworkLockModify(ctx context.Context, addKeys, removeKeys []tka.Key) error
- func (lc *Client) NetworkLockSign(ctx context.Context, nodeKey key.NodePublic, rotationPublic []byte) error
- func (lc *Client) NetworkLockStatus(ctx context.Context) (*ipnstate.NetworkLockStatus, error)
- func (lc *Client) NetworkLockSubmitRecoveryAUM(ctx context.Context, aum tka.AUM) error
- func (lc *Client) NetworkLockVerifySigningDeeplink(ctx context.Context, url string) (*tka.DeeplinkValidationResult, error)
- func (lc *Client) NetworkLockWrapPreauthKey(ctx context.Context, preauthKey string, tkaKey key.NLPrivate) (string, error)
- func (lc *Client) Ping(ctx context.Context, ip netip.Addr, pingtype tailcfg.PingType) (*ipnstate.PingResult, error)
- func (lc *Client) PingWithOpts(ctx context.Context, ip netip.Addr, pingtype tailcfg.PingType, opts PingOpts) (*ipnstate.PingResult, error)
- func (lc *Client) Pprof(ctx context.Context, pprofType string, sec int) ([]byte, error)
- func (lc *Client) ProfileStatus(ctx context.Context) (current ipn.LoginProfile, all []ipn.LoginProfile, err error)
- func (lc *Client) PushFile(ctx context.Context, target tailcfg.StableNodeID, size int64, name string, ...) error
- func (lc *Client) QueryDNS(ctx context.Context, name string, queryType string) (bytes []byte, resolvers []*dnstype.Resolver, err error)
- func (lc *Client) QueryFeature(ctx context.Context, feature string) (*tailcfg.QueryFeatureResponse, error)
- func (lc *Client) QueryOptionalFeatures(ctx context.Context) (*apitype.OptionalFeatures, error)
- func (lc *Client) ReloadConfig(ctx context.Context) (ok bool, err error)
- func (lc *Client) ReloadEffectivePolicy(ctx context.Context, scope setting.PolicyScope) (*setting.Snapshot, error)
- func (lc *Client) SetComponentDebugLogging(ctx context.Context, component string, d time.Duration) error
- func (lc *Client) SetDNS(ctx context.Context, name, value string) error
- func (lc *Client) SetDevStoreKeyValue(ctx context.Context, key, value string) error
- func (lc *Client) SetServeConfig(ctx context.Context, config *ipn.ServeConfig) error
- func (lc *Client) SetUDPGROForwarding(ctx context.Context) error
- func (lc *Client) SetUseExitNode(ctx context.Context, on bool) error
- func (lc *Client) ShutdownTailscaled(ctx context.Context) error
- func (lc *Client) Start(ctx context.Context, opts ipn.Options) error
- func (lc *Client) StartLoginInteractive(ctx context.Context) error
- func (lc *Client) Status(ctx context.Context) (*ipnstate.Status, error)
- func (lc *Client) StatusWithoutPeers(ctx context.Context) (*ipnstate.Status, error)
- func (lc *Client) StreamBusEvents(ctx context.Context) iter.Seq2[eventbus.DebugEvent, error]
- func (lc *Client) StreamDebugCapture(ctx context.Context) (io.ReadCloser, error)
- func (lc *Client) SuggestExitNode(ctx context.Context) (apitype.ExitNodeSuggestionResponse, error)
- func (lc *Client) SwitchProfile(ctx context.Context, profile ipn.ProfileID) error
- func (lc *Client) SwitchToEmptyProfile(ctx context.Context) error
- func (lc *Client) TailDaemonLogs(ctx context.Context) (io.Reader, error)
- func (lc *Client) UserDial(ctx context.Context, network, host string, port uint16) (net.Conn, error)
- func (lc *Client) UserMetrics(ctx context.Context) ([]byte, error)
- func (lc *Client) WaitingFiles(ctx context.Context) ([]apitype.WaitingFile, error)
- func (lc *Client) WatchIPNBus(ctx context.Context, mask ipn.NotifyWatchOpt) (*IPNBusWatcher, error)
- func (lc *Client) WhoIs(ctx context.Context, remoteAddr string) (*apitype.WhoIsResponse, error)
- func (lc *Client) WhoIsNodeKey(ctx context.Context, key key.NodePublic) (*apitype.WhoIsResponse, error)
- func (lc *Client) WhoIsProto(ctx context.Context, proto, remoteAddr string) (*apitype.WhoIsResponse, error)
- type DebugPortmapOpts
- type IPNBusWatcher
- type PingOpts
- type PreconditionsFailedError
Constants¶
This section is empty.
Variables¶
var ErrPeerNotFound =errors.New("peer not found")ErrPeerNotFound is returned byClient.WhoIs,Client.WhoIsNodeKey andClient.WhoIsProto when a peer is not found.
Functions¶
funcExpandSNINamedeprecated
funcGetCertificatedeprecated
func GetCertificate(hi *tls.ClientHelloInfo) (*tls.Certificate,error)
GetCertificate fetches a TLS certificate for the TLS ClientHello in hi.
It returns a cached certificate from disk if it's still valid.
It's the right signature to use as the value oftls.Config.GetCertificate.
Deprecated: useClient.GetCertificate.
funcIsAccessDeniedError¶
IsAccessDeniedError reports whether err is or wraps an AccessDeniedError.
funcIsPreconditionsFailedError¶
IsPreconditionsFailedError reports whether err is or wraps an PreconditionsFailedError.
funcSetVersionMismatchHandler¶
func SetVersionMismatchHandler(f func(clientVer, serverVerstring))
SetVersionMismatchHandler sets f as the version mismatch handlerto be called when the client (the current process) has a versionnumber that doesn't match the server's declared version.
funcStatusWithoutPeers¶
StatusWithoutPeers returns the Tailscale daemon's status, without the peer info.
funcWhoIsdeprecated
WhoIs returns the owner of the remoteAddr, which must be an IP or IP:port.
Deprecated: useClient.WhoIs.
Types¶
typeAccessDeniedError¶
type AccessDeniedError struct {// contains filtered or unexported fields}AccessDeniedError is an error due to permissions.
func (*AccessDeniedError)Error¶
func (e *AccessDeniedError) Error()string
func (*AccessDeniedError)Unwrap¶
func (e *AccessDeniedError) Unwrap()error
typeBugReportOpts¶
type BugReportOpts struct {// Note contains an optional user-provided note to add to the logs.Notestring// Diagnose specifies whether to print additional diagnostic information to// the logs when generating this bugreport.Diagnosebool// Record specifies, if non-nil, whether to perform a bugreport// "recording"–generating an initial log marker, then waiting for// this channel to be closed before finishing the request, which// generates another log marker.Record <-chan struct{}}BugReportOpts contains options to pass to the Tailscale daemon whengenerating a bug report.
typeClient¶
type Client struct {// Dial optionally specifies an alternate func that connects to the local// machine's tailscaled or equivalent. If nil, a default is used.Dial func(ctxcontext.Context, network, addrstring) (net.Conn,error)// Transport optionally specifies an alternate [http.RoundTripper]// used to execute HTTP requests. If nil, a default [http.Transport] is used,// potentially with custom dialing logic from [Dial].// It is primarily used for testing.Transporthttp.RoundTripper// Socket specifies an alternate path to the local Tailscale socket.// If empty, a platform-specific default is used.Socketstring// UseSocketOnly, if true, tries to only connect to tailscaled via the// Unix socket and not via fallback mechanisms as done on macOS when// connecting to the GUI client variants.UseSocketOnlybool// OmitAuth, if true, omits sending the local Tailscale daemon any// authentication token that might be required by the platform.//// As of 2024-08-12, only macOS uses an authentication token. OmitAuth is// meant for when Dial is set and the LocalAPI is being proxied to a// different operating system, such as in integration tests.OmitAuthbool// contains filtered or unexported fields}Client is a client to Tailscale's "LocalAPI", communicating with theTailscale daemon on the local machine. Its API is not necessarily stable andsubject to changes between releases. Some API calls have strictercompatibility guarantees, once they've been widely adopted. See method docsfor details.
Its zero value is valid to use.
Any exported fields should be set before using methods on the typeand not changed thereafter.
func (*Client)AwaitWaitingFiles¶
func (lc *Client) AwaitWaitingFiles(ctxcontext.Context, dtime.Duration) ([]apitype.WaitingFile,error)
AwaitWaitingFiles is likeClient.WaitingFiles but takes a duration to await for an answer.If the duration is 0, it will return immediately. The duration is respected at secondgranularity only. If no files are available, it returns (nil, nil).
func (*Client)BugReport¶
BugReport logs and returns a log marker that can be shared by the user with support.
This is the same as callingClient.BugReportWithOpts and only specifying the Notefield.
func (*Client)BugReportWithOpts¶
BugReportWithOpts logs and returns a log marker that can be shared by theuser with support.
The opts type specifies options to pass to the Tailscale daemon whengenerating this bug report.
func (*Client)CertPair¶
CertPair returns a cert and private key for the provided DNS domain.
It returns a cached certificate from disk if it's still valid.
API maturity: this is considered a stable API.
func (*Client)CertPairWithValidity¶
func (lc *Client) CertPairWithValidity(ctxcontext.Context, domainstring, minValiditytime.Duration) (certPEM, keyPEM []byte, errerror)
CertPairWithValidity returns a cert and private key for the provided DNSdomain.
It returns a cached certificate from disk if it's still valid.When minValidity is non-zero, the returned certificate will be valid for atleast the given duration, if permitted by the CA. If the certificate isvalid, but for less than minValidity, it will be synchronously renewed.
API maturity: this is considered a stable API.
func (*Client)CheckIPForwarding¶
CheckIPForwarding asks the local Tailscale daemon whether it looks like themachine is properly configured to forward IP packets as a subnet routeror exit node.
func (*Client)CheckPrefs¶
CheckPrefs validates the provided preferences, without making any changes.
The CLI uses this before a Start call to fail fast if the preferences won'twork. Currently (2022-04-18) this only checks for SSH server compatibility.Note that EditPrefs does the same validation as this, so call CheckPrefs beforeEditPrefs is not necessary.
func (*Client)CheckReversePathFiltering¶added inv1.86.0
CheckReversePathFiltering asks the local Tailscale daemon whether strictreverse path filtering is enabled, which would break exit node usage on Linux.
func (*Client)CheckSOMarkInUse¶added inv1.92.0
CheckSOMarkInUse reports whether the socket mark option is in use. This will onlybe true if tailscale is running on Linux and tailscaled uses SO_MARK.
func (*Client)CheckUDPGROForwarding¶
CheckUDPGROForwarding asks the local Tailscale daemon whether it looks likethe machine is optimally configured to forward UDP packets as a subnet routeror exit node.
func (*Client)CheckUpdate¶
CheckUpdate returns a*tailcfg.ClientVersion indicating whether or not an update is availableto be installed via the LocalAPI. In case the LocalAPI can't install updates, it returns aClientVersion that says that we are up to date.
func (*Client)CurrentDERPMap¶
CurrentDERPMap returns the current DERPMap that is being used by the local tailscaled.It is intended to be used with netcheck to see availability of DERPs.
func (*Client)DaemonMetrics¶
DaemonMetrics returns the Tailscale daemon's metrics inthe Prometheus text exposition format.
func (*Client)DebugAction¶
DebugAction invokes a debug action, such as "rebind" or "restun".These are development tools and subject to change or removal over time.
func (*Client)DebugActionBody¶
DebugActionBody invokes a debug action with a body parameter, such as"debug-force-prefer-derp".These are development tools and subject to change or removal over time.
func (*Client)DebugDERPRegion¶
func (*Client)DebugPacketFilterRules¶
DebugPacketFilterRules returns the packet filter rules for the current device.
func (*Client)DebugPeerRelaySessions¶added inv1.90.0
DebugPeerRelaySessions returns debug information about the current peerrelay sessions running through this node.
func (*Client)DebugPortmap¶
func (lc *Client) DebugPortmap(ctxcontext.Context, opts *DebugPortmapOpts) (io.ReadCloser,error)
DebugPortmap invokes the debug-portmap endpoint, and returns anio.ReadCloser that can be used to read the logs that are printed during thisprocess.
opts can be nil; if so, default values will be used.
func (*Client)DebugResultJSON¶
DebugResultJSON invokes a debug action and returns its result as something JSON-able.These are development tools and subject to change or removal over time.
func (*Client)DebugSetExpireIn¶
DebugSetExpireIn marks the current node key to expire in d.
This is meant primarily for debug and testing.
func (*Client)DeleteProfile¶
DeleteProfile removes the profile with the given ID.If the profile is the current profile, an empty profilewill be selected as ifClient.SwitchToEmptyProfile was called.
func (*Client)DeleteWaitingFile¶
func (*Client)DialTCP¶
DialTCP connects to the host's port via Tailscale.
The host may be a base DNS name (resolved from the netmap insidetailscaled), a FQDN, or an IP address.
The ctx is only used for the duration of the call, not the lifetime of thenet.Conn.
func (*Client)DisconnectControl¶
DisconnectControl shuts down all connections to control, thus making control consider this node inactive. This can berun on HA subnet router or app connector replicas before shutting them down to ensure peers get told to switch overto another replica whilst there is still some grace period for the existing connections to terminate.
func (*Client)DoLocalRequest¶
DoLocalRequest makes an HTTP request to the local machine's Tailscale daemon.
URLs are of the formhttp://local-tailscaled.sock/localapi/v0/whois?ip=1.2.3.4.
The hostname must be "local-tailscaled.sock", even though itdoesn't actually do any DNS lookup. The actual means of connecting to andauthenticating to the local Tailscale daemon vary by platform.
DoLocalRequest may mutate the request to add Authorization headers.
func (*Client)DriveSetServerAddr¶
DriveSetServerAddr instructs Taildrive to use the server at addr to accessthe filesystem. This is used on platforms like Windows and MacOS to letTaildrive know to use the file server running in the GUI app.
func (*Client)DriveShareList¶
DriveShareList returns the list of shares that drive is currently servingto remote nodes.
func (*Client)DriveShareRemove¶
DriveShareRemove removes the share with the given name from the list ofshares that Taildrive will serve to remote nodes.
func (*Client)DriveShareRename¶
DriveShareRename renames the share from old to new name.
func (*Client)DriveShareSet¶
DriveShareSet adds or updates the given share in the list of shares thatTaildrive will serve to remote nodes. If a share with the same name alreadyexists, the existing share is replaced/updated.
func (*Client)EditPrefs¶
EditPrefs updates theipn.Prefs of the current Tailscale profile, applying the changes in mp.It returns an error if the changes cannot be applied, such as due to the caller's access rightsor a policy restriction. An optional reason or justification for the request can beprovided as a context value usingapitype.RequestReasonKey. If permitted by policy,access may be granted, and the reason will be logged for auditing purposes.
func (*Client)EventBusGraph¶added inv1.86.0
EventBusGraph returns a graph of active publishers and subscribers in the eventbusas aeventbus.DebugTopics
func (*Client)ExpandSNIName¶
ExpandSNIName expands bare label name into the most likely actual TLS cert name.
func (*Client)FileTargets¶
func (*Client)GetAppConnectorRouteInfo¶added inv1.90.0
func (*Client)GetCertificate¶
func (lc *Client) GetCertificate(hi *tls.ClientHelloInfo) (*tls.Certificate,error)
GetCertificate fetches a TLS certificate for the TLS ClientHello in hi.
It returns a cached certificate from disk if it's still valid.
It's the right signature to use as the value oftls.Config.GetCertificate.
API maturity: this is considered a stable API.
func (*Client)GetDNSOSConfig¶
GetDNSOSConfig returns the system DNS configuration for the current device.That is, it returns the DNS configuration that the system would use if Tailscale weren't being used.
func (*Client)GetEffectivePolicy¶
func (lc *Client) GetEffectivePolicy(ctxcontext.Context, scopesetting.PolicyScope) (*setting.Snapshot,error)
GetEffectivePolicy returns the effective policy for the specified scope.
func (*Client)GetServeConfig¶
GetServeConfig return the current serve config.
If the serve config is empty, it returns (nil, nil).
func (*Client)GetWaitingFile¶
func (*Client)Goroutines¶
Goroutines returns a dump of the Tailscale daemon's current goroutines.
func (*Client)IDToken¶
IDToken is a request to get an OIDC ID token for an audience.The token can be presented to any resource provider which offers OIDCFederation.
func (*Client)IncrementCounter¶
IncrementCounter increments the value of a Tailscale daemon's countermetric by the given delta. If the metric has yet to exist, a new countermetric is created and initialized to delta.
IncrementCounter does not support gauge metrics or negative delta values.
func (*Client)IncrementGauge¶added inv1.86.0
IncrementGauge increments the value of a Tailscale daemon's gaugemetric by the given delta. If the metric has yet to exist, a new gaugemetric is created and initialized to delta. The delta value can be negative.
func (*Client)NetworkLockAffectedSigs¶
func (lc *Client) NetworkLockAffectedSigs(ctxcontext.Context, keyIDtkatype.KeyID) ([]tkatype.MarshaledSignature,error)
NetworkLockAffectedSigs returns all signatures signed by the specified keyID.
func (*Client)NetworkLockCosignRecoveryAUM¶
NetworkLockCosignRecoveryAUM co-signs a recovery AUM using the node's tailnet lock key.
func (*Client)NetworkLockDisable¶
NetworkLockDisable shuts down network-lock across the tailnet.
func (*Client)NetworkLockForceLocalDisable¶
NetworkLockForceLocalDisable forcibly shuts down network lock on this node.
func (*Client)NetworkLockGenRecoveryAUM¶
func (lc *Client) NetworkLockGenRecoveryAUM(ctxcontext.Context, removeKeys []tkatype.KeyID, forkFromtka.AUMHash) ([]byte,error)
NetworkLockGenRecoveryAUM generates an AUM for recovering from a tailnet-lock key compromise.
func (*Client)NetworkLockInit¶
func (lc *Client) NetworkLockInit(ctxcontext.Context, keys []tka.Key, disablementValues [][]byte, supportDisablement []byte) (*ipnstate.NetworkLockStatus,error)
NetworkLockInit initializes the tailnet key authority.
TODO(tom): Plumb through disablement secrets.
func (*Client)NetworkLockLog¶
func (lc *Client) NetworkLockLog(ctxcontext.Context, maxEntriesint) ([]ipnstate.NetworkLockUpdate,error)
NetworkLockLog returns up to maxEntries number of changes to network-lock state.
func (*Client)NetworkLockModify¶
NetworkLockModify adds and/or removes key(s) to the tailnet key authority.
func (*Client)NetworkLockSign¶
func (lc *Client) NetworkLockSign(ctxcontext.Context, nodeKeykey.NodePublic, rotationPublic []byte)error
NetworkLockSign signs the specified node-key and transmits that signature to the control plane.rotationPublic, if specified, must be an ed25519 public key.
func (*Client)NetworkLockStatus¶
NetworkLockStatus fetches information about the tailnet key authority, if one is configured.
func (*Client)NetworkLockSubmitRecoveryAUM¶
NetworkLockSubmitRecoveryAUM submits a recovery AUM to the control plane.
func (*Client)NetworkLockVerifySigningDeeplink¶
func (lc *Client) NetworkLockVerifySigningDeeplink(ctxcontext.Context, urlstring) (*tka.DeeplinkValidationResult,error)
NetworkLockVerifySigningDeeplink verifies the network lock deeplink containedin url and returns information extracted from it.
func (*Client)NetworkLockWrapPreauthKey¶
func (lc *Client) NetworkLockWrapPreauthKey(ctxcontext.Context, preauthKeystring, tkaKeykey.NLPrivate) (string,error)
NetworkLockWrapPreauthKey wraps a pre-auth key with information toenable unattended bringup in the locked tailnet.
func (*Client)Ping¶
func (lc *Client) Ping(ctxcontext.Context, ipnetip.Addr, pingtypetailcfg.PingType) (*ipnstate.PingResult,error)
Ping sends a ping of the provided type to the provided IP and waitsfor its response.
func (*Client)PingWithOpts¶
func (lc *Client) PingWithOpts(ctxcontext.Context, ipnetip.Addr, pingtypetailcfg.PingType, optsPingOpts) (*ipnstate.PingResult,error)
Ping sends a ping of the provided type to the provided IP and waitsfor its response. The opts type specifies additional options.
func (*Client)ProfileStatus¶
func (lc *Client) ProfileStatus(ctxcontext.Context) (currentipn.LoginProfile, all []ipn.LoginProfile, errerror)
ProfileStatus returns the current profile and the list of all profiles.
func (*Client)PushFile¶
func (lc *Client) PushFile(ctxcontext.Context, targettailcfg.StableNodeID, sizeint64, namestring, rio.Reader)error
PushFile sends Taildrop file r to target.
A size of -1 means unknown.The name parameter is the original filename, not escaped.
func (*Client)QueryDNS¶
func (lc *Client) QueryDNS(ctxcontext.Context, namestring, queryTypestring) (bytes []byte, resolvers []*dnstype.Resolver, errerror)
QueryDNS executes a DNS query for a name (`google.com.`) and query type (`CNAME`).It returns the raw DNS response bytes and the resolvers that were used to answer the query(often just one, but can be more if we raced multiple resolvers).
func (*Client)QueryFeature¶
func (lc *Client) QueryFeature(ctxcontext.Context, featurestring) (*tailcfg.QueryFeatureResponse,error)
QueryFeature makes a request for instructions on how to enablea feature, such as Funnel, for the node's tailnet. If relevant,this includes a control server URL the user can visit to enablethe feature.
If you are looking to use QueryFeature, you'll likely want touse cli.enableFeatureInteractive instead, which handles the logicof wraping QueryFeature and translating its response into aninteractive flow for the user, including using the IPN notify busto block until the feature has been enabled.
2023-08-09: Valid feature values are "serve" and "funnel".
func (*Client)QueryOptionalFeatures¶added inv1.90.4
QueryOptionalFeatures queries the optional features supported by the Tailscale daemon.
func (*Client)ReloadConfig¶
ReloadConfig reloads the config file, if possible.
func (*Client)ReloadEffectivePolicy¶
func (lc *Client) ReloadEffectivePolicy(ctxcontext.Context, scopesetting.PolicyScope) (*setting.Snapshot,error)
ReloadEffectivePolicy reloads the effective policy for the specified scopeby reading and merging policy settings from all applicable policy sources.
func (*Client)SetComponentDebugLogging¶
func (lc *Client) SetComponentDebugLogging(ctxcontext.Context, componentstring, dtime.Duration)error
SetComponentDebugLogging sets component's debug logging enabled forthe provided duration. If the duration is in the past, the debug loggingis disabled.
func (*Client)SetDNS¶
SetDNS adds a DNS TXT record for the given domain name, containingthe provided TXT value. The intended use case is answeringLetsEncrypt/ACME dns-01 challenges.
The control plane will only permit SetDNS requests with veryspecific names and values. The name should be"_acme-challenge." + your node's MagicDNS name. It's expected thatclients cache the certs from LetsEncrypt (or whichever CA isproviding them) and only request new ones as needed; the control planerate limits SetDNS requests.
This is a low-level interface; it's expected that most Tailscaleusers use a higher level interface to getting/using TLScertificates.
func (*Client)SetDevStoreKeyValue¶
SetDevStoreKeyValue set a statestore key/value. It's only meant for development.The schema (including when keys are re-read) is not a stable interface.
func (*Client)SetServeConfig¶
SetServeConfig sets or replaces the serving settings.If config is nil, settings are cleared and serving is disabled.
func (*Client)SetUDPGROForwarding¶
SetUDPGROForwarding enables UDP GRO forwarding for the main interface of thisnode. This can be done to improve performance of tailnet nodes acting as exitnodes or subnet routers.Seehttps://tailscale.com/kb/1320/performance-best-practices#linux-optimizations-for-subnet-routers-and-exit-nodes
func (*Client)SetUseExitNode¶
SetUseExitNode toggles the use of an exit node on or off.To turn it on, there must have been a previously used exit node.The most previously used one is reused.This is a convenience method for GUIs. To select an actual one, update the prefs.
func (*Client)ShutdownTailscaled¶added inv1.90.0
ShutdownTailscaled requests a graceful shutdown of tailscaled.
func (*Client)StartLoginInteractive¶
StartLoginInteractive starts an interactive login.
func (*Client)StatusWithoutPeers¶
StatusWithoutPeers returns the Tailscale daemon's status, without the peer info.
func (*Client)StreamBusEvents¶added inv1.86.0
StreamBusEvents returns an iterator of Tailscale bus events as they arrive.Each pair is a valid event and a nil error, or a zero event a non-nil error.In case of error, the iterator ends after the pair reporting the error.Iteration stops if ctx ends.
func (*Client)StreamDebugCapture¶
StreamDebugCapture streams a pcap-formatted packet capture.
The provided context does not determine the lifetime of thereturnedio.ReadCloser.
func (*Client)SuggestExitNode¶
SuggestExitNode requests an exit node suggestion and returns the exit node's details.
func (*Client)SwitchProfile¶
SwitchProfile switches to the given profile.
func (*Client)SwitchToEmptyProfile¶
SwitchToEmptyProfile creates and switches to a new unnamed profile. The newprofile is not assigned an ID until it is persisted after a successful login.In order to login to the new profile, the user must call LoginInteractive.
func (*Client)TailDaemonLogs¶
TailDaemonLogs returns a stream the Tailscale daemon's logs as they arrive.Close the context to stop the stream.
func (*Client)UserDial¶
UserDial connects to the host's port via Tailscale for the given network.
The host may be a base DNS name (resolved from the netmap inside tailscaled),a FQDN, or an IP address.
The ctx is only used for the duration of the call, not the lifetime of thenet.Conn.
func (*Client)UserMetrics¶
UserMetrics returns the user metrics inthe Prometheus text exposition format.
func (*Client)WaitingFiles¶
WaitingFiles returns the list of received Taildrop files that have beenreceived by the Tailscale daemon in its staging/cache directory but not yettransferred by the user's CLI or GUI client and written to a user's homedirectory somewhere.
func (*Client)WatchIPNBus¶
func (lc *Client) WatchIPNBus(ctxcontext.Context, maskipn.NotifyWatchOpt) (*IPNBusWatcher,error)
WatchIPNBus subscribes to the IPN notification bus. It returns a watcheronce the bus is connected successfully.
The context is used for the life of the watch, not just the call toWatchIPNBus.
The returnedIPNBusWatcher's Close method must be called when done to releaseresources.
A default set of ipn.Notify messages are returned but the set can be modified by mask.
func (*Client)WhoIs¶
WhoIs returns the owner of the remoteAddr, which must be an IP or IP:port.
If not found, the error isErrPeerNotFound.
For connections proxied by tailscaled, this looks up the owner of the givenaddress as TCP first, falling back to UDP; if you want to only check aspecific address family, use WhoIsProto.
func (*Client)WhoIsNodeKey¶
func (lc *Client) WhoIsNodeKey(ctxcontext.Context, keykey.NodePublic) (*apitype.WhoIsResponse,error)
WhoIsNodeKey returns the owner of the given wireguard public key.
If not found, the error is ErrPeerNotFound.
func (*Client)WhoIsProto¶
func (lc *Client) WhoIsProto(ctxcontext.Context, proto, remoteAddrstring) (*apitype.WhoIsResponse,error)
WhoIsProto returns the owner of the remoteAddr, which must be an IP orIP:port, for the given protocol (tcp or udp).
If not found, the error isErrPeerNotFound.
typeDebugPortmapOpts¶
type DebugPortmapOpts struct {// Duration is how long the mapping should be created for. It defaults// to 5 seconds if not set.Durationtime.Duration// Type is the kind of portmap to debug. The empty string instructs the// portmap client to perform all known types. Other valid options are// "pmp", "pcp", and "upnp".Typestring// GatewayAddr specifies the gateway address used during portmapping.// If set, SelfAddr must also be set. If unset, it will be// autodetected.GatewayAddrnetip.Addr// SelfAddr specifies the gateway address used during portmapping. If// set, GatewayAddr must also be set. If unset, it will be// autodetected.SelfAddrnetip.Addr// LogHTTP instructs the debug-portmap endpoint to print all HTTP// requests and responses made to the logs.LogHTTPbool}DebugPortmapOpts contains options for theClient.DebugPortmap command.
typeIPNBusWatcher¶
type IPNBusWatcher struct {// contains filtered or unexported fields}IPNBusWatcher is an active subscription (watch) of the local tailscaled IPN bus.It's returned byClient.WatchIPNBus.
It must be closed when done.
func (*IPNBusWatcher)Close¶
func (w *IPNBusWatcher) Close()error
Close stops the watcher and releases its resources.
typePingOpts¶
type PingOpts struct {// Size is the length of the ping message in bytes. It's ignored if it's// smaller than the minimum message size.//// For disco pings, it specifies the length of the packet's payload. That// is, it includes the disco headers and message, but not the IP and UDP// headers.Sizeint}PingOpts contains options for the ping request.
The zero value is valid, which means to use defaults.
typePreconditionsFailedError¶
type PreconditionsFailedError struct {// contains filtered or unexported fields}PreconditionsFailedError is returned when the server respondswith an HTTP 412 status code.
func (*PreconditionsFailedError)Error¶
func (e *PreconditionsFailedError) Error()string
func (*PreconditionsFailedError)Unwrap¶
func (e *PreconditionsFailedError) Unwrap()error