zerotier

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Package zerotier provides a high-level client for the Zerotier network controller API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateIPAddresses added in v0.8.0

func CalculateIPAddresses(
	networkID string, v6AssignMode zerotier.V6AssignMode, member zerotier.ControllerNetworkMember,
) (allIPAddresses []string, ndpAddresses []string, err error)

func CalculateNDPAddresses added in v0.8.0

func CalculateNDPAddresses(
	networkID string, sixplane, rfc4193 bool, memberAddress string,
) (ndpAddresses []string, err error)

func GetControllerAddress

func GetControllerAddress(networkID string) string

Types

type Cache

type Cache struct {
	Cache      clientcache.Cache
	CostWeight float32
}

func (*Cache) GetNetworkByID

func (c *Cache) GetNetworkByID(id string) (*zerotier.ControllerNetwork, bool, error)

func (*Cache) GetNetworkMembersByID

func (c *Cache) GetNetworkMembersByID(networkID string) ([]string, error)

func (*Cache) SetNetworkByID

func (c *Cache) SetNetworkByID(id string, network zerotier.ControllerNetwork) error

func (*Cache) SetNetworkMembersByID

func (c *Cache) SetNetworkMembersByID(networkID string, members []string) error

func (*Cache) SetNonexistentNetworkByID

func (c *Cache) SetNonexistentNetworkByID(id string)

func (*Cache) UnsetNetworkByID

func (c *Cache) UnsetNetworkByID(id string)

func (*Cache) UnsetNetworkMembersByID

func (c *Cache) UnsetNetworkMembersByID(networkID string)

type Client

type Client struct {
	Config Config
	Logger godest.Logger
	Cache  *Cache
}

func NewClient

func NewClient(c Config, cache clientcache.Cache, l godest.Logger) *Client

func (*Client) CreateNetwork

func (c *Client) CreateNetwork(
	ctx context.Context, controller ztcontrollers.Controller, cc *ztcontrollers.Client,
) (*zerotier.ControllerNetwork, error)

func (*Client) DeleteNetwork

func (c *Client) DeleteNetwork(
	ctx context.Context, controller ztcontrollers.Controller, id string, cc *ztcontrollers.Client,
) error

func (*Client) GetAllNetworkIDs

func (c *Client) GetAllNetworkIDs(
	ctx context.Context, controllers []ztcontrollers.Controller, cc *ztcontrollers.Client,
) ([][]string, error)

func (*Client) GetAllNetworks

func (c *Client) GetAllNetworks(
	ctx context.Context, controllers []ztcontrollers.Controller, ids [][]string,
) ([]map[string]zerotier.ControllerNetwork, error)

func (*Client) GetControllerInfo

func (c *Client) GetControllerInfo(
	ctx context.Context, controller ztcontrollers.Controller, cc *ztcontrollers.Client,
) (*zerotier.Status, *zerotier.ControllerStatus, []string, error)

func (*Client) GetControllerStatuses

func (c *Client) GetControllerStatuses(
	ctx context.Context, controller ztcontrollers.Controller, cc *ztcontrollers.Client,
) (*zerotier.Status, *zerotier.ControllerStatus, error)

func (*Client) GetNetwork

func (c *Client) GetNetwork(
	ctx context.Context, controller ztcontrollers.Controller, id string,
) (*zerotier.ControllerNetwork, error)

func (*Client) GetNetworkIDs

func (c *Client) GetNetworkIDs(
	ctx context.Context, controller ztcontrollers.Controller, cc *ztcontrollers.Client,
) ([]string, error)

func (*Client) GetNetworkInfo

func (c *Client) GetNetworkInfo(
	ctx context.Context, controller ztcontrollers.Controller, id string,
) (*zerotier.ControllerNetwork, []string, error)

func (*Client) GetNetworkMember

func (c *Client) GetNetworkMember(
	ctx context.Context, controller ztcontrollers.Controller, networkID string, memberAddress string,
) (*zerotier.ControllerNetworkMember, error)

func (*Client) GetNetworkMemberAddresses

func (c *Client) GetNetworkMemberAddresses(
	ctx context.Context, controller ztcontrollers.Controller, id string,
) ([]string, error)

func (*Client) GetNetworkMembers

func (c *Client) GetNetworkMembers(
	ctx context.Context, controller ztcontrollers.Controller, networkID string,
	memberAddresses []string,
) (map[string]zerotier.ControllerNetworkMember, error)

func (*Client) GetNetworks

func (c *Client) GetNetworks(
	ctx context.Context, controller ztcontrollers.Controller, ids []string,
) (map[string]zerotier.ControllerNetwork, error)

func (*Client) UpdateMember

func (c *Client) UpdateMember(
	ctx context.Context, controller ztcontrollers.Controller, networkID string,
	memberAddress string, member zerotier.SetControllerNetworkMemberJSONRequestBody,
) error

type Config

type Config struct {
	DNS ZTDNSSettings
}

func GetConfig

func GetConfig() (c Config, err error)

type ZTDNSSettings

type ZTDNSSettings struct {
	NetworkTTL int64 `json:"networkTTL"`
	DeviceTTL  int64 `json:"deviceTTL"`
}

func GetDNSSettings

func GetDNSSettings() (s ZTDNSSettings, err error)

Jump to

Keyboard shortcuts

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