tailscale

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package tailscale tracks the tailscale state (e.g., version) if available.

Index

Constants

View Source
const (
	StateNameTailscaleVersion = "tailscale_version"

	StateKeyTailscaleVersionData           = "data"
	StateKeyTailscaleVersionEncoding       = "encoding"
	StateValueTailscaleVersionEncodingJSON = "json"
)
View Source
const Name = "tailscale"

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context) (_ any, e error)

func New

func TailscaleExists

func TailscaleExists() bool

Types

type Config

type Config struct {
	Query query_config.Config `json:"query"`
}

func ParseConfig

func ParseConfig(b any, db *sql.DB) (*Config, error)

func (Config) Validate

func (cfg Config) Validate() error

type Output

type Output struct {
	Version VersionInfo `json:"version"`
}

func ParseOutputJSON

func ParseOutputJSON(data []byte) (*Output, error)

func ParseStateTailscale

func ParseStateTailscale(m map[string]string) (*Output, error)

func ParseStatesToOutput

func ParseStatesToOutput(states ...components.State) (*Output, error)

func (*Output) Evaluate

func (o *Output) Evaluate() (string, bool, error)

Returns the output evaluation reason and its healthy-ness.

func (*Output) JSON

func (o *Output) JSON() ([]byte, error)

func (*Output) States

func (o *Output) States() ([]components.State, error)

type VersionInfo

type VersionInfo struct {
	MajorMinorPatch string `json:"majorMinorPatch"`
	Short           string `json:"short"`
	Long            string `json:"long"`
	UnstableBranch  bool   `json:"unstableBranch"`
	Cap             int    `json:"cap"`
}

VersionInfo represents the JSON structure of the Tailscale version information.

func CheckVersion

func CheckVersion() (*VersionInfo, error)

CheckVersion returns the tailscale version by running `tailscale version --json`.

func ParseVersion

func ParseVersion(b []byte) (*VersionInfo, error)

ParseVersion parses the JSON-encoded version information from a byte slice.

Jump to

Keyboard shortcuts

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