tailscale

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CGNATRange returns the Carrier Grade NAT address range that
	// is the superset range that Tailscale assigns out of.
	// See https://tailscale.com/s/cgnat
	// Note that Tailscale does not assign out of the ChromeOSVMRange.
	CGNATRange = mustPrefix("100.64.0.0/10")
	// ChromeOSVMRange returns the subset of the CGNAT IPv4 range used by
	// ChromeOS to interconnect the host OS to containers and VMs. We
	// avoid allocating Tailscale IPs from it, to avoid conflicts.
	ChromeOSVMRange = mustPrefix("100.115.92.0/23")
	// TailscaleULARange returns the IPv6 Unique Local Address range that
	// is the superset range that Tailscale assigns out of.
	TailscaleULARange = mustPrefix("fd7a:115c:a1e0::/48")
)

Functions

func Interface

func Interface() ([]netip.Addr, *net.Interface, error)

Adapted from tailscale.com/net/interfaces interfaces.go

Interface returns the current machine's Tailscale interface, if any. If none is found, all zero values are returned. A non-nil error is only returned on a problem listing the system interfaces.

func IsTailscaleIP

func IsTailscaleIP(ip netip.Addr) bool

Adapted from tailscale.com/net/tsaddr tsaddr.go

IsTailscaleIP reports whether ip is an IP address in a range that Tailscale assigns from.

func Path

func Path() (bin string, err error)

Path searches and returns the Tailscale CLI executable location

Types

type TSCli

type TSCli struct {
	Prefix []string
}

Wrapper of the tailscale command, exposing only a minimal interface Set up the command Prefix before using (e.g. {"/path/to/tailscale", "-kwarg=value"})

func (*TSCli) RunGet

func (ts *TSCli) RunGet(ctx context.Context, targetDir string) ([]byte, error)

func (*TSCli) RunStatus

func (ts *TSCli) RunStatus(ctx context.Context) (*TSStatus, error)

func (*TSCli) StartCp

func (ts *TSCli) StartCp(ctx context.Context, name string, target string, logE func(string, ...any)) (stdin io.WriteCloser, err error)

type TSStatus

type TSStatus struct {
	Tun   *bool     `json:"TUN"`
	TsIPs *[]string `json:"TailscaleIPs"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL