Documentation ¶
Index ¶
- func DNSOrQuoteHostname(st *ipnstate.Status, ps *ipnstate.PeerStatus) string
- type Client
- func (c *Client) AcceptRoutes(ctx context.Context, accept bool) error
- func (c *Client) AdvertiseExitNode(ctx context.Context, enable bool) error
- func (c *Client) AdvertiseRoutes(ctx context.Context, routes []netip.Prefix) error
- func (c *Client) AllowLANAccess(ctx context.Context, allow bool) error
- func (c *Client) DeleteWaitingFile(ctx context.Context, name string) error
- func (c *Client) ExitNode(ctx context.Context, peer *ipnstate.PeerStatus) error
- func (c *Client) GetWaitingFile(ctx context.Context, name string) (io.ReadCloser, int64, error)
- func (c *Client) NetCheck(ctx context.Context, full bool) (*netcheck.Report, *tailcfg.DERPMap, error)
- func (c *Client) Prefs(ctx context.Context) (*ipn.Prefs, error)
- func (c *Client) PushFile(ctx context.Context, target tailcfg.StableNodeID, size int64, name string, ...) error
- func (c *Client) SetControlURL(ctx context.Context, controlURL string) error
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) Status(ctx context.Context) (*ipnstate.Status, error)
- func (c *Client) Stop(ctx context.Context) error
- func (c *Client) WaitingFiles(ctx context.Context) ([]apitype.WaitingFile, error)
- type Poller
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DNSOrQuoteHostname ¶ added in v0.9.4
func DNSOrQuoteHostname(st *ipnstate.Status, ps *ipnstate.PeerStatus) string
DNSOrQuoteHostname returns a nicely printable version of a peer's name. The function is copied from https://github.com/tailscale/tailscale/blob/b0ed863d55d6b51569ce5c6bd0b7021338ce6a82/cmd/tailscale/cli/status.go#L285
Types ¶
type Client ¶
type Client struct { // Command is the command to call for the Tailscale CLI binary. It // defaults to "tailscale". Command string }
Client is a client for Tailscale's services. Some functionality is handled via the Go API, and some is handled via execution of the Tailscale CLI binary.
func (*Client) AcceptRoutes ¶ added in v0.10.3
AcceptRoutes sets whether or not all shared subnet routes from other nodes should be used by the local node.
func (*Client) AdvertiseExitNode ¶
AdvertiseExitNode enables and disables exit node advertisement for the current node.
func (*Client) AdvertiseRoutes ¶
func (*Client) AllowLANAccess ¶
AllowLANAccess enables and disables the ability for the current node to get access to the regular LAN that it is connected to while an exit node is in use.
func (*Client) DeleteWaitingFile ¶ added in v0.10.0
func (*Client) ExitNode ¶
ExitNode uses the specified peer as an exit node, or unsets an existing exit node if peer is nil.
func (*Client) GetWaitingFile ¶ added in v0.10.0
func (*Client) SetControlURL ¶ added in v0.10.0
SetControlURL changes the URL of the control plane server used by the daemon. If controlURL is empty, the default Tailscale server is used.
func (*Client) Status ¶
Status returns the status of the connection to the Tailscale network. If the network is not currently connected, it returns nil, nil.
func (*Client) WaitingFiles ¶ added in v0.10.0
WaitingFiles polls for any pending incoming files. It blocks for an extended period of time.
type Poller ¶ added in v0.9.0
type Poller struct { // TS is the Client to use to interact with Tailscale. // // If it is nil, a default client will be used. TS *Client // Interval is the default interval to use for polling. // // If it is a zero, a non-zero default will be used. Interval time.Duration // If non-nil, New will be called when a new status is received from // Tailscale. New func(Status) // contains filtered or unexported fields }
A Poller gets the latest Tailscale status at regular intervals or when manually triggered.
A zero-value of a Poller is ready to use.
It is a race condition to change any exported fields of Poller while Run is running.
func (*Poller) Get ¶ added in v0.9.0
Get returns a channel that will yield the latest Status fetched. If a new Status is in the process of being fetched, it will wait for that to finish and then yield that.
func (*Poller) Poll ¶ added in v0.9.0
func (p *Poller) Poll() chan<- struct{}
Poll returns a channel that, when sent to, causes a new status to be fetched from Tailscale. A send to the channel does not resolve until the poller begins to fetch the status, meaning that a send to Poll followed immediately by a receive from Get will always result in the new Status.
Do not close the returned channel. Doing so will result in undefined behavior.
func (*Poller) Run ¶ added in v0.9.0
Run runs the poller. It blocks until polling is done, which is generally a result of the given Context being cancelled.
The behavior of two calls to Run running concurrently is undefined. Don't do it.
func (*Poller) SetInterval ¶ added in v0.10.0
SetInterval returns a channel that modifies the polling interval of a running poller. This will delay the next poll until the new interval has elapsed.