config

package
v0.0.0-...-e07aa5a Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandFilename

func ExpandFilename(nodeID, filename string) (string, error)

func FindDataDirs

func FindDataDirs(identity string) ([]string, error)

Types

type Config

type Config struct {
	Global Global          `yaml:"global"`
	Nodes  map[string]Node `yaml:"nodes"`
}

func (*Config) Load

func (c *Config) Load(filename string) error

func (*Config) Marshal

func (c *Config) Marshal() ([]byte, error)

func (*Config) Save

func (c *Config) Save(filename string) error

func (*Config) Unmarshal

func (c *Config) Unmarshal(data []byte) error

type Cpctl

type Cpctl struct {
	SocketFile string `yaml:"socket_file,omitempty"`
	NoSocket   bool   `yaml:"no_socket,omitempty"`
	Port       int    `yaml:"port,omitempty"`
}

type Dns

type Dns struct {
	Disable bool `yaml:"disable,omitempty"`
}

type Global

type Global struct {
	Domain         string                       `yaml:"domain"`
	Subnet         proto.Subnet                 `yaml:"subnet"`
	AuthorizedKeys []proto.MarshalablePublicKey `yaml:"authorized_keys"`
	LastUpdated    time.Time                    `yaml:"last_updated,omitempty"`
}

type Namespace

type Namespace struct {
	Address  proto.IP                    `yaml:"address"`
	Cost     float32                     `yaml:"cost,omitempty"`
	Services map[string]NamespaceService `yaml:"services,omitempty"`
}

type NamespaceService

type NamespaceService struct {
	Command string `yaml:"command"`
}

type Node

type Node struct {
	Address    proto.IP             `yaml:"address"`
	Backends   map[string]Params    `yaml:"backends,omitempty"`
	Services   map[string]Service   `yaml:"services,omitempty"`
	TunDevs    map[string]TunDev    `yaml:"tun_devs,omitempty"`
	Namespaces map[string]Namespace `yaml:"namespaces,omitempty"`
	Cpctl      Cpctl                `yaml:"cpctl,omitempty"`
	Dns        Dns                  `yaml:"dns,omitempty"`
}

type Params

type Params map[string]string

func (Params) GetBool

func (p Params) GetBool(name string, defaultValue bool) (bool, error)

func (Params) GetFloat32

func (p Params) GetFloat32(name string, defaultValue float32) (float32, error)

func (Params) GetHostPort

func (p Params) GetHostPort(name string) (net.IP, uint16, error)

func (Params) GetIP

func (p Params) GetIP(name string) (net.IP, error)

func (Params) GetPort

func (p Params) GetPort(name string) (uint16, error)

func (Params) GetString

func (p Params) GetString(name string, defaultValue string) string

type Service

type Service struct {
	Port    int    `yaml:"port"`
	Command string `yaml:"command"`
}

type TunDev

type TunDev struct {
	DeviceName string   `yaml:"device"`
	Address    proto.IP `yaml:"address"`
	Cost       float32  `yaml:"cost,omitempty"`
}

Jump to

Keyboard shortcuts

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