Documentation ¶
Index ¶
- func AcceptRoutes(ctx context.Context, accept bool) error
- func AdvertiseExitNode(ctx context.Context, enable bool) error
- func AdvertiseRoutes(ctx context.Context, routes []netip.Prefix) error
- func AllowLANAccess(ctx context.Context, allow bool) error
- func CanMullvad(peer *ipnstate.PeerStatus) bool
- func CompareLocations(loc1, loc2 *tailcfg.Location) int
- func ComparePeers(p1, p2 *ipnstate.PeerStatus) int
- func DNSOrQuoteHostname(st *ipnstate.Status, ps *ipnstate.PeerStatus) string
- func DeleteWaitingFile(ctx context.Context, name string) error
- func ExitNode(ctx context.Context, peer *ipnstate.PeerStatus) error
- func GetStatus(ctx context.Context) (*ipnstate.Status, error)
- func GetWaitingFile(ctx context.Context, name string) (io.ReadCloser, int64, error)
- func IsMullvad(peer *ipnstate.PeerStatus) bool
- func NetCheck(ctx context.Context, full bool) (*netcheck.Report, *tailcfg.DERPMap, error)
- func Prefs(ctx context.Context) (*ipn.Prefs, error)
- func PushFile(ctx context.Context, target tailcfg.StableNodeID, size int64, name string, ...) error
- func SetControlURL(ctx context.Context, controlURL string) error
- func Start(ctx context.Context) error
- func Stop(ctx context.Context) error
- func WaitingFiles(ctx context.Context) ([]apitype.WaitingFile, error)
- type Poller
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptRoutes ¶ added in v0.12.5
AcceptRoutes sets whether or not all shared subnet routes from other nodes should be used by the local node.
func AdvertiseExitNode ¶ added in v0.12.5
AdvertiseExitNode enables and disables exit node advertisement for the current node.
func AdvertiseRoutes ¶ added in v0.12.5
func AllowLANAccess ¶ added in v0.12.5
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 CanMullvad ¶ added in v0.12.0
func CanMullvad(peer *ipnstate.PeerStatus) bool
CanMullvad returns true if peer is allowed to access Mullvad exit nodes.
func CompareLocations ¶ added in v0.12.2
CompareLocations alphabestically compares the countries and then, if necessary, cities of two Locations.
func ComparePeers ¶ added in v0.12.4
func ComparePeers(p1, p2 *ipnstate.PeerStatus) int
ComparePeers compares two peers. It does so by location if available, then by hostname. It returns the peers in a deterministic order if their locations or hostnames are identical, so the result of calling this is never 0. To determine if peers are the same, compare their IDs manually.
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
func DeleteWaitingFile ¶ added in v0.12.5
func ExitNode ¶ added in v0.12.5
func ExitNode(ctx context.Context, peer *ipnstate.PeerStatus) error
ExitNode uses the specified peer as an exit node, or unsets an existing exit node if peer is nil.
func GetStatus ¶ added in v0.12.5
GetStatus returns the status of the connection to the Tailscale network. If the network is not currently connected, it returns nil, nil.
func GetWaitingFile ¶ added in v0.12.5
func IsMullvad ¶ added in v0.12.0
func IsMullvad(peer *ipnstate.PeerStatus) bool
IsMullvad returns true if peer is a Mullvad exit node.
func SetControlURL ¶ added in v0.12.5
SetControlURL changes the URL of the control plane server used by the daemon. If controlURL is empty, the default Tailscale server is used.
func WaitingFiles ¶ added in v0.12.5
func WaitingFiles(ctx context.Context) ([]apitype.WaitingFile, error)
WaitingFiles polls for any pending incoming files. It returns quickly if there are no files currently pending.
Types ¶
type Poller ¶ added in v0.9.0
type Poller struct { // 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.