tailscale
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 tailscale contains a Go client for the Tailscale control plane API.
This package is only intended for internal and transitional use.
Deprecated: the official control plane client is available attailscale.com/client/tailscale/v2.
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 HandleErrorResponse(b []byte, resp *http.Response) errordeprecated
- func IsAccessDeniedError(err error) booldeprecated
- func IsPreconditionsFailedError(err error) booldeprecated
- func SetVersionMismatchHandler(f func(clientVer, serverVer string))deprecated
- func Status(ctx context.Context) (*ipnstate.Status, error)deprecated
- func StatusWithoutPeers(ctx context.Context) (*ipnstate.Status, error)deprecated
- func WhoIs(ctx context.Context, remoteAddr string) (*apitype.WhoIsResponse, error)deprecated
- type ACL
- type ACLDetails
- type ACLHuJSON
- type ACLPreview
- type ACLPreviewResponse
- type ACLRow
- type ACLTest
- type ACLTestError
- type ACLTestFailureSummary
- type APIKey
- type AuthMethod
- type BugReportOptsdeprecated
- type Clientdeprecated
- func (c *Client) ACL(ctx context.Context) (acl *ACL, err error)
- func (c *Client) ACLHuJSON(ctx context.Context) (acl *ACLHuJSON, err error)
- func (c *Client) AuthorizeDevice(ctx context.Context, deviceID string) error
- func (c *Client) BuildTailnetURL(pathElements ...any) string
- func (c *Client) BuildURL(pathElements ...any) string
- func (c *Client) CreateKey(ctx context.Context, caps KeyCapabilities) (keySecret string, keyMeta *Key, _ error)
- func (c *Client) CreateKeyWithExpiry(ctx context.Context, caps KeyCapabilities, expiry time.Duration) (keySecret string, keyMeta *Key, _ error)
- func (c *Client) DNSConfig(ctx context.Context) (cfg *apitype.DNSConfig, err error)
- func (c *Client) DNSPreferences(ctx context.Context) (dnsResp *DNSPreferences, err error)
- func (c *Client) DeleteDevice(ctx context.Context, deviceID string) (err error)
- func (c *Client) DeleteKey(ctx context.Context, id string) error
- func (c *Client) Device(ctx context.Context, deviceID string, fields *DeviceFieldsOpts) (device *Device, err error)
- func (c *Client) Devices(ctx context.Context, fields *DeviceFieldsOpts) (deviceList []*Device, err error)
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) Key(ctx context.Context, id string) (*Key, error)
- func (c *Client) Keys(ctx context.Context) ([]string, error)
- func (c *Client) NameServers(ctx context.Context) (nameservers []string, err error)
- func (c *Client) PreviewACLForIPPort(ctx context.Context, acl ACL, ipport netip.AddrPort) (res *ACLPreview, err error)
- func (c *Client) PreviewACLForUser(ctx context.Context, acl ACL, user string) (res *ACLPreview, err error)
- func (c *Client) PreviewACLHuJSONForIPPort(ctx context.Context, acl ACLHuJSON, ipport string) (res *ACLPreview, err error)
- func (c *Client) PreviewACLHuJSONForUser(ctx context.Context, acl ACLHuJSON, user string) (res *ACLPreview, err error)
- func (c *Client) Routes(ctx context.Context, deviceID string) (routes *Routes, err error)
- func (c *Client) SearchPaths(ctx context.Context) (searchpaths []string, err error)
- func (c *Client) SetACL(ctx context.Context, acl ACL, avoidCollisions bool) (res *ACL, err error)
- func (c *Client) SetACLHuJSON(ctx context.Context, acl ACLHuJSON, avoidCollisions bool) (res *ACLHuJSON, err error)
- func (c *Client) SetAuthorized(ctx context.Context, deviceID string, authorized bool) error
- func (c *Client) SetDNSConfig(ctx context.Context, cfg apitype.DNSConfig) (resp *apitype.DNSConfig, err error)
- func (c *Client) SetDNSPreferences(ctx context.Context, magicDNS bool) (dnsResp *DNSPreferences, err error)
- func (c *Client) SetNameServers(ctx context.Context, nameservers []string) (dnsResp *DNSNameServersPostResponse, err error)
- func (c *Client) SetRoutes(ctx context.Context, deviceID string, subnets []netip.Prefix) (routes *Routes, err error)
- func (c *Client) SetSearchPaths(ctx context.Context, searchpaths []string) (newSearchPaths []string, err error)
- func (c *Client) SetTags(ctx context.Context, deviceID string, tags []string) error
- func (c *Client) Tailnet() string
- func (c *Client) TailnetDeleteRequest(ctx context.Context, tailnetID string) (err error)
- func (c *Client) ValidateACLJSON(ctx context.Context, source, dest string) (testErr *ACLTestError, err error)
- type ClientConnectivity
- type DNSNameServers
- type DNSNameServersPostResponse
- type DNSPreferences
- type DNSSearchPaths
- type DerpRegion
- type Device
- type DeviceFieldsOpts
- type DevicePostureIdentity
- type ErrResponse
- type GetDevicesResponse
- type IPNBusWatcherdeprecated
- type Key
- type KeyCapabilities
- type KeyDeviceCapabilities
- type KeyDeviceCreateCapabilities
- type LocalClientdeprecated
- type NodeAttrGrant
- type PingOptsdeprecated
- type Routes
- type UserRuleMatch
Constants¶
This section is empty.
Variables¶
var (DeviceAllFields = &DeviceFieldsOpts{}// DeviceDefaultFields specifies that the following fields are returned:// Addresses, NodeID, User, Name, Hostname, ClientVersion, UpdateAvailable,// OS, Created, LastSeen, KeyExpiryDisabled, Expires, Authorized, IsExternal// MachineKey, NodeKey, BlocksIncomingConnections.DeviceDefaultFields = &DeviceFieldsOpts{})
var ErrPeerNotFound =local.ErrPeerNotFoundErrPeerNotFound is an alias fortailscale.com/client/local.ErrPeerNotFound.
Deprecated: importtailscale.com/client/local instead.
var I_Acknowledge_This_API_Is_Unstable =falseI_Acknowledge_This_API_Is_Unstable must be set true to use this packagefor now. This package is being replaced bytailscale.com/client/tailscale/v2.
Functions¶
funcCertPairdeprecatedadded inv1.14.0
CertPair is an alias fortailscale.com/client/local.CertPair.
Deprecated: importtailscale.com/client/local instead and uselocal.Client.CertPair.
funcExpandSNINamedeprecatedadded inv1.14.0
ExpandSNIName is an alias fortailscale.com/client/local.ExpandSNIName.
Deprecated: importtailscale.com/client/local instead and uselocal.Client.ExpandSNIName.
funcGetCertificatedeprecatedadded inv1.14.0
func GetCertificate(hi *tls.ClientHelloInfo) (*tls.Certificate,error)
GetCertificate is an alias fortailscale.com/client/local.GetCertificate.
Deprecated: importtailscale.com/client/local instead and uselocal.Client.GetCertificate.
funcHandleErrorResponsedeprecatedadded inv1.82.0
HandleErrorResponse decodes the error message from the server and returnsanErrResponse from it.
Deprecated: usetailscale.com/client/tailscale/v2 instead.
funcIsAccessDeniedErrordeprecatedadded inv1.14.6
IsAccessDeniedError is an alias fortailscale.com/client/local.IsAccessDeniedError.
Deprecated: importtailscale.com/client/local instead.
funcIsPreconditionsFailedErrordeprecatedadded inv1.50.0
IsPreconditionsFailedError is an alias fortailscale.com/client/local.IsPreconditionsFailedError.
Deprecated: importtailscale.com/client/local instead.
funcSetVersionMismatchHandlerdeprecatedadded inv1.16.0
func SetVersionMismatchHandler(f func(clientVer, serverVerstring))
SetVersionMismatchHandler is an alias fortailscale.com/client/local.SetVersionMismatchHandler.
Deprecated: importtailscale.com/client/local instead.
funcStatusdeprecatedadded inv1.8.0
Status is an alias fortailscale.com/client/local.Status.
Deprecated: importtailscale.com/client/local instead.
funcStatusWithoutPeersdeprecatedadded inv1.8.0
StatusWithoutPeers is an alias fortailscale.com/client/local.StatusWithoutPeers.
Deprecated: importtailscale.com/client/local instead.
funcWhoIsdeprecated
WhoIs is an alias fortailscale.com/client/local.WhoIs.
Deprecated: importtailscale.com/client/local instead and uselocal.Client.WhoIs.
Types¶
typeACL¶added inv1.26.0
type ACL struct {ACLACLDetailsETagstring// to check with version on server}ACL contains an ACLDetails and metadata.
typeACLDetails¶added inv1.26.0
type ACLDetails struct {Tests []ACLTest `json:"tests,omitempty"`ACLs []ACLRow `json:"acls,omitempty"`Groups map[string][]string `json:"groups,omitempty"`TagOwners map[string][]string `json:"tagowners,omitempty"`Hosts map[string]string `json:"hosts,omitempty"`NodeAttrs []NodeAttrGrant `json:"nodeAttrs,omitempty"`}ACLDetails contains all the details for an ACL.
typeACLPreview¶added inv1.26.0
type ACLPreview struct {Matches []UserRuleMatch `json:"matches"`Userstring `json:"user,omitempty"`// Filled if response of PreviewACLForUser or PreviewACLHuJSONForUserIPPortstring `json:"ipport,omitempty"`// Filled if response of PreviewACLForIPPort or PreviewACLHuJSONForIPPort// Postures is a map of postures and associated rules that apply// to this preview.// For more details about the posture mapping, see://https://tailscale.com/kb/1288/device-posture#posturesPostures map[string][]string `json:"postures,omitempty"`}ACLPreview is the response type of PreviewACLForUser, PreviewACLForIPPort, PreviewACLHuJSONForUser, and PreviewACLHuJSONForIPPort
typeACLPreviewResponse¶added inv1.26.0
type ACLPreviewResponse struct {Matches []UserRuleMatch `json:"matches"`// ACL rules that match the specified user or ipport.Typestring `json:"type"`// The request type: currently only "user" or "ipport".PreviewForstring `json:"previewFor"`// A specific user or ipport.// Postures is a map of postures and associated rules that apply// to this preview.// For more details about the posture mapping, see://https://tailscale.com/kb/1288/device-posture#posturesPostures map[string][]string `json:"postures,omitempty"`}ACLPreviewResponse is the response type of previewACLPostRequest
typeACLRow¶added inv1.26.0
type ACLRow struct {Actionstring `json:"action,omitempty"`// valid values: "accept"Protostring `json:"proto,omitempty"`// protocolUsers []string `json:"users,omitempty"`// old name for srcPorts []string `json:"ports,omitempty"`// old name for dstSrc []string `json:"src,omitempty"`Dst []string `json:"dst,omitempty"`}ACLRow defines a rule that grants access by a set of users or groups to a setof servers and ports.Only one of Src/Dst or Users/Ports may be specified.
typeACLTest¶added inv1.26.0
type ACLTest struct {Srcstring `json:"src,omitempty"`// sourceUserstring `json:"user,omitempty"`// old name for sourceProtostring `json:"proto,omitempty"`// protocolAccept []string `json:"accept,omitempty"`// expected destination ip:port that user can accessDeny []string `json:"deny,omitempty"`// expected destination ip:port that user cannot accessAllow []string `json:"allow,omitempty"`// old name for accept}ACLTest defines a test for your ACLs to prevent accidental exposure orrevoking of access to key servers and ports. Only one of Src or User may bespecified, and only one of Allow/Accept may be specified.
typeACLTestError¶added inv1.26.0
type ACLTestError struct {ErrResponseData []ACLTestFailureSummary `json:"data"`}ACLTestError is ErrResponse but with an extra field to account for ACLTestFailureSummary.
func (ACLTestError)Error¶added inv1.26.0
func (eACLTestError) Error()string
typeACLTestFailureSummary¶added inv1.26.0
type ACLTestFailureSummary struct {// User is the source ("src") value of the ACL test that failed.// The name "user" is a legacy holdover from the original naming and// is kept for compatibility but it may also contain any value// that's valid in a ACL test "src" field.Userstring `json:"user,omitempty"`Errors []string `json:"errors,omitempty"`Warnings []string `json:"warnings,omitempty"`}ACLTestFailureSummary specifies a user for which ACL testsfailed and the related user-friendly error messages.
ACLTestFailureSummary specifies the JSON format sent to theJavaScript client to be rendered in the HTML.
typeAPIKey¶added inv1.26.0
type APIKeystring
APIKey is anAuthMethod forNewClient that authenticates requestsusing an authkey.
typeAuthMethod¶added inv1.26.0
type AuthMethod interface {// contains filtered or unexported methods}AuthMethod is the interface for API authentication methods.
Most users will use AuthKey.
typeBugReportOptsdeprecatedadded inv1.32.0
type BugReportOpts =local.BugReportOpts
BugReportOpts is an alias fortailscale.com/client/local.BugReportOpts.
Deprecated: importtailscale.com/client/local instead.
typeClientdeprecatedadded inv1.26.0
type Client struct {// BaseURL optionally specifies an alternate API server to use.// If empty, "https://api.tailscale.com" is used.BaseURLstring// HTTPClient optionally specifies an alternate HTTP client to use.// If nil, [http.DefaultClient] is used.HTTPClient *http.Client// UserAgent optionally specifies an alternate User-Agent headerUserAgentstring// contains filtered or unexported fields}Client makes API calls to the Tailscale control plane API server.
UseNewClient to instantiate one. Exported fields should be set beforethe client is used and not changed thereafter.
Deprecated: usetailscale.com/client/tailscale/v2 instead.
funcNewClientdeprecatedadded inv1.26.0
func NewClient(tailnetstring, authAuthMethod) *Client
NewClient is a convenience method for instantiating a newClient.
tailnet is the globally unique identifier for a Tailscale network, suchas "example.com" or "user@gmail.com".If httpClient is nil, thenhttp.DefaultClient is used."api.tailscale.com" is set as the BaseURL for the returned clientand can be changed manually by the user.
Deprecated: usetailscale.com/client/tailscale/v2 instead.
func (*Client)ACL¶added inv1.26.0
ACL makes a call to the Tailscale server to get a JSON-parsed version of the ACL.The JSON-parsed version of the ACL contains no comments as proper JSON does not supportcomments.
func (*Client)ACLHuJSON¶added inv1.26.0
ACLHuJSON makes a call to the Tailscale server to get the ACL HuJSON and returnsit as a string.HuJSON is JSON with a few modifications to make it more human-friendly. The primarychanges are allowing comments and trailing comments. See the following links for more info:https://tailscale.com/s/acl-formathttps://github.com/tailscale/hujson
func (*Client)AuthorizeDevice¶added inv1.26.0
AuthorizeDevice marks a device as authorized.
func (*Client)BuildTailnetURL¶added inv1.82.0
BuildTailnetURL builds a url to http(s)://<apiserver>/api/v2/tailnet/<tailnet>/<slash-separated-pathElements>using the given pathElements. It url escapes each path element, so thecaller doesn't need to worry about that. The last item of pathElements canbe of type url.Values to add a query string to the URL.
For example, BuildTailnetURL(policy, validate) with the default server URL and a tailnet of "example.com"would result inhttps://api.tailscale.com/api/v2/tailnet/example.com/policy/validate.
func (*Client)BuildURL¶added inv1.82.0
BuildURL builds a url to http(s)://<apiserver>/api/v2/<slash-separated-pathElements>using the given pathElements. It url escapes each path element, so thecaller doesn't need to worry about that. The last item of pathElements canbe of type url.Values to add a query string to the URL.
For example, BuildURL(devices, 5) with the default server URL would result inhttps://api.tailscale.com/api/v2/devices/5.
func (*Client)CreateKey¶added inv1.36.0
func (c *Client) CreateKey(ctxcontext.Context, capsKeyCapabilities) (keySecretstring, keyMeta *Key, _error)
CreateKey creates a new key for the current user. Currently, only auth keyscan be created. It returns the secret key itself, which cannot be retrieved againlater, and the key metadata.
To create a key with a specific expiry, use CreateKeyWithExpiry.
func (*Client)CreateKeyWithExpiry¶added inv1.42.0
func (c *Client) CreateKeyWithExpiry(ctxcontext.Context, capsKeyCapabilities, expirytime.Duration) (keySecretstring, keyMeta *Key, _error)
CreateKeyWithExpiry is like CreateKey, but allows specifying a expiration time.
The time is truncated to a whole number of seconds. If zero, that means no expiration.
func (*Client)DNSPreferences¶added inv1.26.0
func (c *Client) DNSPreferences(ctxcontext.Context) (dnsResp *DNSPreferences, errerror)
DNSPreferences retrieves the DNS preferences set for a tailnet.
It returns the status of MagicDNS.
func (*Client)DeleteDevice¶added inv1.26.0
DeleteDevice deletes the specified device from the Client's tailnet.NOTE: Only devices that belong to the Client's tailnet can be deleted.Deleting external devices is not supported.
func (*Client)Device¶added inv1.26.0
func (c *Client) Device(ctxcontext.Context, deviceIDstring, fields *DeviceFieldsOpts) (device *Device, errerror)
Device retrieved the details for a specific device.
See the Device structure for the list of fields hidden for an external device.The optional fields parameter specifies which fields of the devices to return; currentlyonly DeviceDefaultFields (equivalent to nil) and DeviceAllFields are supported.Other values are currently undefined.
func (*Client)Devices¶added inv1.26.0
func (c *Client) Devices(ctxcontext.Context, fields *DeviceFieldsOpts) (deviceList []*Device, errerror)
Devices retrieves the list of devices for a tailnet.
See the Device structure for the list of fields hidden for external devices.The optional fields parameter specifies which fields of the devices to return; currentlyonly DeviceDefaultFields (equivalent to nil) and DeviceAllFields are supported.Other values are currently undefined.
func (*Client)Do¶added inv1.26.0
Do sends a raw HTTP request, after adding any authentication headers.
func (*Client)Key¶added inv1.36.0
Key returns the metadata for the given key ID. Currently, capabilities areonly returned for auth keys, API keys only return general metadata.
func (*Client)NameServers¶added inv1.26.0
NameServers retrieves the list of nameservers set for a domain.
func (*Client)PreviewACLForIPPort¶added inv1.26.0
func (c *Client) PreviewACLForIPPort(ctxcontext.Context, aclACL, ipportnetip.AddrPort) (res *ACLPreview, errerror)
PreviewACLForIPPort determines what rules match a given ACL for a ipport.The ACL can be a locally modified or clean ACL obtained from server.
Returns ACLPreview on success with matches in a slice. If there are no matches,the call is still successful but Matches will be an empty slice.Returns error if the provided ACL is invalid.
func (*Client)PreviewACLForUser¶added inv1.26.0
func (c *Client) PreviewACLForUser(ctxcontext.Context, aclACL, userstring) (res *ACLPreview, errerror)
PreviewACLForUser determines what rules match a given ACL for a user.The ACL can be a locally modified or clean ACL obtained from server.
Returns ACLPreview on success with matches in a slice. If there are no matches,the call is still successful but Matches will be an empty slice.Returns error if the provided ACL is invalid.
func (*Client)PreviewACLHuJSONForIPPort¶added inv1.26.0
func (c *Client) PreviewACLHuJSONForIPPort(ctxcontext.Context, aclACLHuJSON, ipportstring) (res *ACLPreview, errerror)
PreviewACLHuJSONForIPPort determines what rules match a given ACL for a ipport.The ACL can be a locally modified or clean ACL obtained from server.
Returns ACLPreview on success with matches in a slice. If there are no matches,the call is still successful but Matches will be an empty slice.Returns error if the provided ACL is invalid.
func (*Client)PreviewACLHuJSONForUser¶added inv1.26.0
func (c *Client) PreviewACLHuJSONForUser(ctxcontext.Context, aclACLHuJSON, userstring) (res *ACLPreview, errerror)
PreviewACLHuJSONForUser determines what rules match a given ACL for a user.The ACL can be a locally modified or clean ACL obtained from server.
Returns ACLPreview on success with matches in a slice. If there are no matches,the call is still successful but Matches will be an empty slice.Returns error if the provided ACL is invalid.
func (*Client)Routes¶added inv1.26.0
Routes retrieves the list of subnet routes that have been enabled for a device.The routes that are returned are not necessarily advertised by the device,they have only been preapproved.
func (*Client)SearchPaths¶added inv1.26.0
SearchPaths retrieves the list of searchpaths set for a tailnet.
func (*Client)SetACL¶added inv1.26.0
SetACL sends a POST request to update the ACL according to the provided ACL object. If`avoidCollisions` is true, it will use the ETag obtained in the GET request in an If-Matchheader to check if the previously obtained ACL was the latest version and that no updateswere missed.
Returns error with status code 412 if mistmached ETag and avoidCollisions is set to true.Returns error if ACL has tests that fail.Returns error if there are other errors with the ACL.
func (*Client)SetACLHuJSON¶added inv1.26.0
func (c *Client) SetACLHuJSON(ctxcontext.Context, aclACLHuJSON, avoidCollisionsbool) (res *ACLHuJSON, errerror)
SetACLHuJSON sends a POST request to update the ACL according to the provided ACL object. If`avoidCollisions` is true, it will use the ETag obtained in the GET request in an If-Matchheader to check if the previously obtained ACL was the latest version and that no updateswere missed.
Returns error with status code 412 if mistmached ETag and avoidCollisions is set to true.Returns error if the HuJSON is invalid.Returns error if ACL has tests that fail.Returns error if there are other errors with the ACL.
func (*Client)SetAuthorized¶added inv1.44.0
SetAuthorized marks a device as authorized or not.
func (*Client)SetDNSConfig¶added inv1.26.0
func (*Client)SetDNSPreferences¶added inv1.26.0
func (c *Client) SetDNSPreferences(ctxcontext.Context, magicDNSbool) (dnsResp *DNSPreferences, errerror)
SetDNSPreferences sets the DNS preferences for a tailnet.
MagicDNS can only be enabled when there is at least one nameserver provided.When all nameservers are removed, MagicDNS is disabled and will stay disabled,unless explicitly enabled by a user again.
func (*Client)SetNameServers¶added inv1.26.0
func (c *Client) SetNameServers(ctxcontext.Context, nameservers []string) (dnsResp *DNSNameServersPostResponse, errerror)
SetNameServers sets the list of nameservers for a tailnet to the list providedby the user.
It returns the new list of nameservers and the MagicDNS status in case it wasaffected by the change. For example, removing all nameservers will turn offMagicDNS.
func (*Client)SetRoutes¶added inv1.26.0
func (c *Client) SetRoutes(ctxcontext.Context, deviceIDstring, subnets []netip.Prefix) (routes *Routes, errerror)
SetRoutes updates the list of subnets that are enabled for a device.Subnets must be parsable by net/netip.ParsePrefix.Subnets do not have to be currently advertised by a device, they may be pre-enabled.Returns the updated list of enabled and advertised subnet routes in a *Routes object.
func (*Client)SetSearchPaths¶added inv1.26.0
func (c *Client) SetSearchPaths(ctxcontext.Context, searchpaths []string) (newSearchPaths []string, errerror)
SetSearchPaths sets the list of searchpaths for a tailnet.
func (*Client)TailnetDeleteRequest¶added inv1.26.0
TailnetDeleteRequest handles sending a DELETE request for a tailnet to control.
func (*Client)ValidateACLJSON¶added inv1.26.0
func (c *Client) ValidateACLJSON(ctxcontext.Context, source, deststring) (testErr *ACLTestError, errerror)
ValidateACLJSON takes in the given source and destination (in this situation,it is assumed that you are checking whether the source can connect to destination)and creates an ACLTest from that. It then sends the ACLTest to the control api aclvalidate endpoint, where the test is run. It returns a nil ACLTestError pointer ifno test errors occur.
typeClientConnectivity¶added inv1.26.0
type ClientConnectivity struct {Endpoints []string `json:"endpoints"`DERPstring `json:"derp"`MappingVariesByDestIPopt.Bool `json:"mappingVariesByDestIP"`// DERPLatency is mapped by region name (e.g. "New York City", "Seattle").DERPLatency map[string]DerpRegion `json:"latency"`ClientSupports map[string]opt.Bool `json:"clientSupports"`}typeDNSNameServers¶added inv1.26.0
type DNSNameServers struct {DNS []string `json:"dns"`// DNS name servers}DNSNameServers is returned when retrieving the list of nameservers.It is also the structure provided when setting nameservers.
typeDNSNameServersPostResponse¶added inv1.26.0
type DNSNameServersPostResponse struct {DNS []string `json:"dns"`// DNS name serversMagicDNSbool `json:"magicDNS"`// whether MagicDNS is active for this tailnet (enabled + has fallback nameservers)}DNSNameServersPostResponse is returned when setting the list of DNS nameservers.
It includes the MagicDNS status since nameservers changes may affect MagicDNS.
typeDNSPreferences¶added inv1.26.0
type DNSPreferences struct {MagicDNSbool `json:"magicDNS"`// whether MagicDNS is active for this tailnet (enabled + has fallback nameservers)}DNSPreferences is the preferences set for a given tailnet.
It includes MagicDNS which can be turned on or off. To enable MagicDNS,there must be at least one nameserver. When all nameservers are removed,MagicDNS is disabled.
typeDNSSearchPaths¶added inv1.26.0
type DNSSearchPaths struct {SearchPaths []string `json:"searchPaths"`// DNS search paths}DNSSearchpaths is the list of search paths for a given domain.
typeDerpRegion¶added inv1.26.0
typeDevice¶added inv1.26.0
type Device struct {// Addresses is a list of the devices's Tailscale IP addresses.// It's currently just 1 element, the 100.x.y.z Tailscale IP.Addresses []string `json:"addresses"`DeviceIDstring `json:"id"`NodeIDstring `json:"nodeId"`Userstring `json:"user"`Namestring `json:"name"`Hostnamestring `json:"hostname"`ClientVersionstring `json:"clientVersion"`// Empty for external devices.UpdateAvailablebool `json:"updateAvailable"`// Empty for external devices.OSstring `json:"os"`Tags []string `json:"tags"`Createdstring `json:"created"`// Empty for external devices.LastSeenstring `json:"lastSeen"`KeyExpiryDisabledbool `json:"keyExpiryDisabled"`Expiresstring `json:"expires"`Authorizedbool `json:"authorized"`IsExternalbool `json:"isExternal"`MachineKeystring `json:"machineKey"`// Empty for external devices.NodeKeystring `json:"nodeKey"`// BlocksIncomingConnections is configured via the device's// Tailscale client preferences. This field is only reported// to the API starting with Tailscale 1.3.x clients.BlocksIncomingConnectionsbool `json:"blocksIncomingConnections"`// EnabledRoutes are the previously-approved subnet routes// (e.g. "192.168.4.16/24", "10.5.2.4/32").EnabledRoutes []string `json:"enabledRoutes"`// Empty for external devices.// AdvertisedRoutes are the subnets (both enabled and not enabled)// being requested from the node.AdvertisedRoutes []string `json:"advertisedRoutes"`// Empty for external devices.ClientConnectivity *ClientConnectivity `json:"clientConnectivity"`// PostureIdentity contains extra identifiers collected from the device when// the tailnet has the device posture identification features enabled. If// Tailscale have attempted to collect this from the device but it has not// opted in, PostureIdentity will have Disabled=true.PostureIdentity *DevicePostureIdentity `json:"postureIdentity"`// TailnetLockKey is the tailnet lock public key of the node as a hex string.TailnetLockKeystring `json:"tailnetLockKey,omitempty"`// TailnetLockErr indicates an issue with the tailnet lock node-key signature// on this device. This field is only populated when tailnet lock is enabled.TailnetLockErrstring `json:"tailnetLockError,omitempty"`}typeDeviceFieldsOpts¶added inv1.26.0
type DeviceFieldsOptsDevice
DeviceFieldsOpts determines which fields should be returned in the response.
Please only use DeviceAllFields and DeviceDefaultFields.Other DeviceFieldsOpts are not supported.
TODO: Support other DeviceFieldsOpts.In the future, users should be able to create their own DeviceFieldsOptsas valid arguments by setting the fields they want returned to a "non-nil"value. For example, DeviceFieldsOpts{NodeID: "true"} should only return NodeIDs.
typeDevicePostureIdentity¶added inv1.58.0
typeErrResponse¶added inv1.26.0
ErrResponse is the HTTP error returned by the Tailscale server.
func (ErrResponse)Error¶added inv1.26.0
func (eErrResponse) Error()string
typeGetDevicesResponse¶added inv1.26.0
type GetDevicesResponse struct {Devices []*Device `json:"devices"`} typeIPNBusWatcherdeprecatedadded inv1.34.0
type IPNBusWatcher =local.IPNBusWatcher
IPNBusWatcher is an alias fortailscale.com/client/local.IPNBusWatcher.
Deprecated: importtailscale.com/client/local instead.
typeKey¶added inv1.36.0
type Key struct {IDstring `json:"id"`Createdtime.Time `json:"created"`Expirestime.Time `json:"expires"`CapabilitiesKeyCapabilities `json:"capabilities"`}Key represents a Tailscale API or auth key.
typeKeyCapabilities¶added inv1.36.0
type KeyCapabilities struct {DevicesKeyDeviceCapabilities `json:"devices,omitempty"`}KeyCapabilities are the capabilities of a Key.
typeKeyDeviceCapabilities¶added inv1.36.0
type KeyDeviceCapabilities struct {CreateKeyDeviceCreateCapabilities `json:"create"`}KeyDeviceCapabilities are the device-related capabilities of a Key.
typeKeyDeviceCreateCapabilities¶added inv1.36.0
type KeyDeviceCreateCapabilities struct {Reusablebool `json:"reusable"`Ephemeralbool `json:"ephemeral"`Preauthorizedbool `json:"preauthorized"`Tags []string `json:"tags,omitempty"`}KeyDeviceCreateCapabilities are the device creation capabilities of a Key.
typeLocalClientdeprecatedadded inv1.26.0
LocalClient is an alias fortailscale.com/client/local.Client.
Deprecated: importtailscale.com/client/local instead.
typeNodeAttrGrant¶added inv1.70.0
type NodeAttrGrant struct {// Target specifies which nodes the attributes apply to. The nodes can be a// tag (tag:server), user (alice@example.com), group (group:kids), or *.Target []string `json:"target,omitempty"`// Attr are the attributes to set on Target(s).Attr []string `json:"attr,omitempty"`}NodeAttrGrant defines additional string attributes that apply to specific devices.
typePingOptsdeprecatedadded inv1.48.0
PingOpts is an alias fortailscale.com/client/local.PingOpts.
Deprecated: importtailscale.com/client/local instead.
typeRoutes¶added inv1.26.0
type Routes struct {AdvertisedRoutes []netip.Prefix `json:"advertisedRoutes"`EnabledRoutes []netip.Prefix `json:"enabledRoutes"`}Routes contains the lists of subnet routes that are currently advertised by a device,as well as the subnets that are enabled to be routed by the device.
typeUserRuleMatch¶added inv1.26.0
type UserRuleMatch struct {Users []string `json:"users"`Ports []string `json:"ports"`LineNumberint `json:"lineNumber"`// Via is the list of targets through which Users can access Ports.// Seehttps://tailscale.com/kb/1378/via for more information.Via []string `json:"via,omitempty"`// Postures is a list of posture policies that are// associated with this match. The rules can be looked// up in the ACLPreviewResponse parent struct.// The source of the list is from srcPosture on// an ACL or Grant rule://https://tailscale.com/kb/1288/device-posture#posture-conditionsPostures []string `json:"postures"`}UserRuleMatch specifies the source users/groups/hosts that a rule targetsand the destination ports that they can access.LineNumber is only useful for requests provided in HuJSON form.While JSON requests will have LineNumber, the value is not useful.
Source Files¶
Directories¶
| Path | Synopsis |
|---|---|
Package apitype contains types for the Tailscale LocalAPI and control plane API. | Package apitype contains types for the Tailscale LocalAPI and control plane API. |
example | |
servetlscommand The servetls program shows how to run an HTTPS server using a Tailscale cert via LetsEncrypt. | The servetls program shows how to run an HTTPS server using a Tailscale cert via LetsEncrypt. |