config

package
v0.0.0-...-7fa21a5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const RecordTag = "record"

Variables

View Source
var (
	ErrDump         = errors.New("while dumping configuration to disk")
	ErrLoad         = errors.New("while loading configuration from disk")
	ErrPeerNotFound = errors.New("peer not found")
)
View Source
var (
	FileMutex sync.RWMutex
	EditMutex sync.RWMutex
)
View Source
var HashFunc = sha512.New

Functions

func ToDisk

func ToDisk(filename string, dumperFunc DumperFunc) error

Types

type Config

type Config struct {
	FilenamePrefix string           `json:"-"` // prefix of filename to save to and read from
	Publisher      *Peer            `json:"-"`
	ShutdownWait   time.Duration    `json:"shutdown_wait"`
	AuthKey        *jose.JSONWebKey `json:"auth_key"`
	Listen         ListenConfig     `json:"listen"`
	Peers          []*Peer          `json:"peers"`
	Zones          map[string]*Zone `json:"zones"`
	// contains filtered or unexported fields
}

func LoadJSON

func LoadJSON(r io.Reader) (*Config, error)

func LoadYAML

func LoadYAML(r io.Reader) (*Config, error)

func New

func New(chain *hashchain.Chain) *Config

func (*Config) AddPeer

func (c *Config) AddPeer(peer *Peer)

func (*Config) Chain

func (c *Config) Chain() *hashchain.Chain

func (*Config) CopyFrom

func (c *Config) CopyFrom(newConfig *Config)

func (*Config) FindPeer

func (c *Config) FindPeer(name string) (*Peer, error)

func (*Config) FromDisk

func (c *Config) FromDisk(filename string, loaderFunc LoaderFunc) (*Config, error)

func (*Config) GetPublisher

func (c *Config) GetPublisher() *Peer

func (*Config) Reload

func (c *Config) Reload() error

func (*Config) ReloadChan

func (c *Config) ReloadChan() <-chan struct{}

func (*Config) RemovePeer

func (c *Config) RemovePeer(peer *Peer)

func (*Config) Save

func (c *Config) Save() error

func (*Config) SaveJSON

func (c *Config) SaveJSON(w io.Writer) error

func (*Config) SaveYAML

func (c *Config) SaveYAML(w io.Writer) error

func (*Config) SetChain

func (c *Config) SetChain(chain *hashchain.Chain)

func (*Config) SetPeers

func (c *Config) SetPeers(peers []*Peer)

func (*Config) SetPublisher

func (c *Config) SetPublisher(publisher *Peer)

type DumperFunc

type DumperFunc func(io.Writer) error

type ListenConfig

type ListenConfig struct {
	DNS     string `json:"dns"`
	Control string `json:"control"`
}

type LoaderFunc

type LoaderFunc func(io.Reader) (*Config, error)

type Peer

type Peer struct {
	IPs           []net.IP         `json:"ips"`
	ControlServer string           `json:"control_server"`
	Key           *jose.JSONWebKey `json:"key"`
}

func (*Peer) Name

func (p *Peer) Name() string

type Record

type Record struct {
	Type         string           `json:"type"`
	Name         string           `json:"name"`
	LiteralValue map[string]any   `json:"value"`
	Value        dnsconfig.Record `json:"-"`
}

type Zone

type Zone struct {
	SOA     *dnsconfig.SOA `json:"soa"`
	NS      *dnsconfig.NS  `json:"ns"`
	Records []*Record      `json:"records"`
}

Jump to

Keyboard shortcuts

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