common

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteDevice

func DeleteDevice(tsApiKey, id string) error

func PromptYesNo

func PromptYesNo(question string) (bool, error)

Function that uses promptui to return a boolean value

func RunTailscaleUpCommand

func RunTailscaleUpCommand(command string, nonInteractive bool) error

func SelectRegion

func SelectRegion() (string, error)

Function that uses promptui to return an AWS region fetched from the aws sdk

func UpdatePolicy

func UpdatePolicy(tsApiKey, tailnet string, config Policy) error

func ValidatePolicy

func ValidatePolicy(tsApiKey, tailnet string, config Policy) error

Types

type ACL

type ACL struct {
	Action string   `json:"action,omitempty"`
	Src    []string `json:"src,omitempty"`
	Dst    []string `json:"dst,omitempty"`
	Proto  string   `json:"proto,omitempty"`
}

type AutoApprovers

type AutoApprovers struct {
	Routes   map[string][]string `json:"routes,omitempty"`
	ExitNode []string            `json:"exitNode,omitempty"`
}

type DerpMap

type DerpMap struct {
	Regions map[string]DerpRegion `json:"regions,omitempty"`
}

type DerpRegion

type DerpRegion struct {
	RegionID int    `json:"regionID,omitempty"`
	HostName string `json:"hostName,omitempty"`
}

type Device

type Device struct {
	Addresses                 []string `json:"addresses"`
	Authorized                bool     `json:"authorized"`
	BlocksIncomingConnections bool     `json:"blocksIncomingConnections"`
	ClientVersion             string   `json:"clientVersion"`
	Created                   string   `json:"created"`
	Expires                   string   `json:"expires"`
	Hostname                  string   `json:"hostname"`
	ID                        string   `json:"id"`
	IsExternal                bool     `json:"isExternal"`
	KeyExpiryDisabled         bool     `json:"keyExpiryDisabled"`
	LastSeen                  string   `json:"lastSeen"`
	MachineKey                string   `json:"machineKey,omitempty"`
	Name                      string   `json:"name,omitempty"`
	NodeID                    string   `json:"nodeId"`
	NodeKey                   string   `json:"nodeKey"`
	OS                        string   `json:"os"`
	TailnetLockError          string   `json:"tailnetLockError,omitempty"`
	TailnetLockKey            string   `json:"tailnetLockKey,omitempty"`
	UpdateAvailable           bool     `json:"updateAvailable"`
	User                      string   `json:"user,omitempty"`
	Tags                      []string `json:"tags,omitempty"`
}

func FindActiveXitDevices

func FindActiveXitDevices(tsApiKey, tailnet string) ([]Device, error)

func FindDeviceByHostname

func FindDeviceByHostname(tsApiKey, hostname, tailnet string) (Device, error)

func FindDevicesByHostname

func FindDevicesByHostname(tsApiKey, tailnet string, hostnames []string) ([]Device, error)

func GetDevice

func GetDevice(tsApiKey, id string) (Device, error)

func GetDevices

func GetDevices(tsApiKey, tailnet string) ([]Device, error)

func (Device) HasTag

func (d Device) HasTag(tag string) bool

Create a method HasTag for Device

type Policy

type Policy struct {
	ACLs                []ACL               `json:"acls,omitempty"`
	Hosts               map[string]string   `json:"hosts,omitempty"`
	Groups              map[string][]string `json:"groups,omitempty"`
	Tests               []Test              `json:"tests,omitempty"`
	TagOwners           map[string][]string `json:"tagOwners,omitempty"`
	AutoApprovers       AutoApprovers       `json:"autoApprovers,omitempty"`
	SSH                 []SSHConfiguration  `json:"ssh,omitempty"`
	DerpMap             DerpMap             `json:"derpMap,omitempty"`
	DisableIPv4         bool                `json:"disableIPv4,omitempty"`
	RandomizeClientPort bool                `json:"randomizeClientPort,omitempty"`
}

func GetPolicy

func GetPolicy(tsApiKey, tailnet string) (Policy, error)

type SSHConfiguration

type SSHConfiguration struct {
	Action string   `json:"action,omitempty"`
	Src    []string `json:"src,omitempty"`
	Dst    []string `json:"dst,omitempty"`
	Users  []string `json:"users,omitempty"`
}

type TailscaleStatus

type TailscaleStatus struct {
	ControlURL             string `json:"ControlURL"`
	RouteAll               bool   `json:"RouteAll"`
	AllowSingleHosts       bool   `json:"AllowSingleHosts"`
	ExitNodeID             string `json:"ExitNodeID"`
	ExitNodeIP             string `json:"ExitNodeIP"`
	ExitNodeAllowLANAccess bool   `json:"ExitNodeAllowLANAccess"`
	CorpDNS                bool   `json:"CorpDNS"`
	RunSSH                 bool   `json:"RunSSH"`
	WantRunning            bool   `json:"WantRunning"`
	LoggedOut              bool   `json:"LoggedOut"`
	ShieldsUp              bool   `json:"ShieldsUp"`
	AdvertiseTags          string `json:"AdvertiseTags"`
	Hostname               string `json:"Hostname"`
	NotepadURLs            bool   `json:"NotepadURLs"`
	AdvertiseRoutes        string `json:"AdvertiseRoutes"`
	NoSNAT                 bool   `json:"NoSNAT"`
	NetfilterMode          int    `json:"NetfilterMode"`
	Config                 struct {
		PrivateMachineKey string `json:"PrivateMachineKey"`
		PrivateNodeKey    string `json:"PrivateNodeKey"`
		OldPrivateNodeKey string `json:"OldPrivateNodeKey"`
		Provider          string `json:"Provider"`
		LoginName         string `json:"LoginName"`
		UserProfile       struct {
			ID            int64    `json:"ID"`
			LoginName     string   `json:"LoginName"`
			DisplayName   string   `json:"DisplayName"`
			ProfilePicURL string   `json:"ProfilePicURL"`
			Roles         []string `json:"Roles"`
		} `json:"UserProfile"`
		NetworkLockKey string `json:"NetworkLockKey"`
		NodeID         string `json:"NodeID"`
	} `json:"Config"`
}

type Test

type Test struct {
	Src    string   `json:"src,omitempty"`
	Accept []string `json:"accept,omitempty"`
	Deny   []string `json:"deny,omitempty"`
}

type UserDevices

type UserDevices struct {
	User    string   `json:"user"`
	Devices []Device `json:"devices"`
}

Jump to

Keyboard shortcuts

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