ztcontrollers

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 ztcontrollers provides a high-level client for management of Zerotier network controllers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Cache clientcache.Cache
}

func (*Cache) GetAddressByServer

func (c *Cache) GetAddressByServer(server string) (string, bool, error)

func (*Cache) GetControllerByAddress

func (c *Cache) GetControllerByAddress(address string) (*Controller, bool, error)

func (*Cache) GetNetworkIDsByServer

func (c *Cache) GetNetworkIDsByServer(server string) ([]string, error)

func (*Cache) SetAddressByServer

func (c *Cache) SetAddressByServer(server string, address string, networkCostWeight float32) error

func (*Cache) SetControllerByAddress

func (c *Cache) SetControllerByAddress(address string, ztController Controller) error

func (*Cache) SetNetworkIDsByServer

func (c *Cache) SetNetworkIDsByServer(
	server string, networkIDs []string, costWeight float32,
) error

func (*Cache) UnsetAddressByServer

func (c *Cache) UnsetAddressByServer(server string)

func (*Cache) UnsetControllerByAddress

func (c *Cache) UnsetControllerByAddress(address string)

func (*Cache) UnsetNetworkIDsByServer

func (c *Cache) UnsetNetworkIDsByServer(server 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) FindController

func (c *Client) FindController(name string) (*Controller, error)

func (*Client) FindControllerByAddress

func (c *Client) FindControllerByAddress(ctx context.Context, address string) (*Controller, error)

func (*Client) GetAddress

func (c *Client) GetAddress(ctx context.Context, controller Controller) (string, error)

func (*Client) GetControllers

func (c *Client) GetControllers() ([]Controller, error)

func (*Client) ScanControllers

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

type Config

type Config struct {
	Controller Controller
}

func GetConfig

func GetConfig() (c Config, err error)

type Controller

type Controller struct {
	Server            string  `json:"server"`
	Name              string  `json:"name"` // Must be unique for display purposes!
	Description       string  `json:"description"`
	Authtoken         string  `json:"authtoken"`
	NetworkCostWeight float32 `json:"local"`
}

func GetController

func GetController() (c Controller, err error)

func (Controller) NewClient

func (c Controller) NewClient() (*zerotier.ClientWithResponses, error)

Jump to

Keyboard shortcuts

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