Documentation
¶
Index ¶
- func DNSOrQuoteHostname(st *ipnstate.Status, ps *ipnstate.PeerStatus) string
- type Client
- 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) ExitNode(ctx context.Context, peer *ipnstate.PeerStatus) 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) Start(ctx context.Context) error
- func (c *Client) Status(ctx context.Context) (*ipnstate.Status, error)
- func (c *Client) Stop(ctx context.Context) 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) AdvertiseExitNode ¶
AdvertiseExitNode enables and disables exit node advertisement for the current node.
func (*Client) AdvertiseRoutes ¶
func (*Client) AllowLANAccess ¶
AllowLANAccess enabled 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) ExitNode ¶
ExitNode uses the specified peer as an exit node, or unsets an existing exit node if peer is nil.
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 // 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.