golangzerotierserviceapi

package
v0.0.0-...-81e5d63 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL  string
	Token    string
	Insecure bool
}

Client represents a client for interacting with the ZeroTier API.

func NewClient

func NewClient(baseURL string, token string, insecure bool) *Client

NewClient creates a new instance of Client with the provided base URL and API token.

func (*Client) GetNetworkStatus

func (c *Client) GetNetworkStatus() (Status, error)

func (*Client) JoinNetwork

func (c *Client) JoinNetwork(networkId string) (Network, error)

func (*Client) LeaveNetwork

func (c *Client) LeaveNetwork(networkId string) (LeaveNetwork, error)

func (*Client) MakeDeleteRequest

func (c *Client) MakeDeleteRequest(url string) ([]byte, error)

makeDeleteRequest performs a DELETE request to the specified URL. It returns an error if any.

func (*Client) MakeGetRequest

func (c *Client) MakeGetRequest(url string) ([]byte, error)

makeGetRequest performs a GET request to the specified URL. It returns the response body ([]byte) and an error if any.

func (*Client) MakePostRequest

func (c *Client) MakePostRequest(url string, data io.Reader) ([]byte, error)

makePostRequest performs a POST request to the specified URL with the provided data. It returns the response body ([]byte) and an error if any.

type Join

type Join struct {
	AllowDNS     bool `json:"allowDNS"`
	AllowDefault bool `json:"allowDefault"`
	AllowManaged bool `json:"allowManaged"`
	AllowGlobal  bool `json:"allowGlobal"`
}

type LeaveNetwork

type LeaveNetwork struct {
	Result bool `json:"result"`
}

type Network

type Network struct {
	AllowDNS          bool     `json:"allowDNS"`
	AllowDefault      bool     `json:"allowDefault"`
	AllowManaged      bool     `json:"allowManaged"`
	AllowGlobal       bool     `json:"allowGlobal"`
	AssignedAddresses []string `json:"assignedAddresses"`
	Bridge            bool     `json:"bridge"`
	BroadcastEnabled  bool     `json:"broadcastEnabled"`
	DNS               struct {
		Domain  string   `json:"domain"`
		Servers []string `json:"servers"`
	} `json:"dns"`
	ID                     string `json:"id"`
	Mac                    string `json:"mac"`
	Mtu                    int    `json:"mtu"`
	MulticastSubscriptions []struct {
		Adi int    `json:"adi"`
		Mac string `json:"mac"`
	} `json:"multicastSubscriptions"`
	AuthenticationURL        string `json:"authenticationURL"`
	AuthenticationExpiryTime int    `json:"authenticationExpiryTime"`
	Name                     string `json:"name"`
	NetconfRevision          int    `json:"netconfRevision"`
	PortDeviceName           string `json:"portDeviceName"`
	PortError                int    `json:"portError"`
	Routes                   []struct {
		Flags  int    `json:"flags"`
		Metric int    `json:"metric"`
		Target string `json:"target"`
		Via    string `json:"via"`
	} `json:"routes"`
	Status    string      `json:"status"`
	Type      string      `json:"type"`
	Property1 interface{} `json:"property1"`
	Property2 interface{} `json:"property2"`
}

type Status

type Status struct {
	Address string `json:"address"`
	Clock   int64  `json:"clock"`
	Config  struct {
		Settings struct {
			AllowTCPFallbackRelay bool     `json:"allowTcpFallbackRelay"`
			ForceTCPRelay         bool     `json:"forceTcpRelay"`
			ListeningOn           []string `json:"listeningOn"`
			PortMappingEnabled    bool     `json:"portMappingEnabled"`
			PrimaryPort           int      `json:"primaryPort"`
			SecondaryPort         int      `json:"secondaryPort"`
			SoftwareUpdate        string   `json:"softwareUpdate"`
			SoftwareUpdateChannel string   `json:"softwareUpdateChannel"`
			SurfaceAddresses      []string `json:"surfaceAddresses"`
			TertiaryPort          int      `json:"tertiaryPort"`
		} `json:"settings"`
	} `json:"config"`
	Online               bool   `json:"online"`
	PlanetWorldID        int    `json:"planetWorldId"`
	PlanetWorldTimestamp int64  `json:"planetWorldTimestamp"`
	PublicIdentity       string `json:"publicIdentity"`
	TCPFallbackActive    bool   `json:"tcpFallbackActive"`
	Version              string `json:"version"`
	VersionBuild         int    `json:"versionBuild"`
	VersionMajor         int    `json:"versionMajor"`
	VersionMinor         int    `json:"versionMinor"`
	VersionRev           int    `json:"versionRev"`
}

Jump to

Keyboard shortcuts

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