cfg

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cfg configures the dyn-ip daemon

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudflareAPI

type CloudflareAPI struct {
	Access struct {
		// Key is the API key for Cloudflare
		Key string

		// Email is the email associated with the API key
		Email string
	}

	// list of Zones to update
	Zones map[string]*Zone
}

CloudflareAPI configures the accessto cloudflare

type Config

type Config struct {
	// Listen configures where to listen for IP updates
	Listen *ListenConfig

	// StateFile stores the location of the state file
	StateFile string `yaml:"state_file"`

	// Destinations stores all places to be updated
	Destinations *DestinationsConfig

	// Logging configuration
	Logging *LoggingConfig `yaml:"logging"`
}

Config holds the dyn-ip configuration

func New

func New() *Config

New creates a default configuration

func Parse

func Parse(src io.Reader) (*Config, error)

Parse parses the configuration from an io.Reader

func ParseFile

func ParseFile(path string) (*Config, error)

ParseFile parses the configuration from a file

func (*Config) String

func (c *Config) String() string

String provides quick info about what this configuration updates

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration file

type DestinationsConfig

type DestinationsConfig struct {
	// configures the cloudflare API
	Cloudflare *CloudflareAPI `yaml:"cloudflare,omitempty"`
	// configures the file update config
	File *FileConfig `yaml:"file,omitempty"`
}

DestinationsConfig stores all output destinations

type FileConfig

type FileConfig struct {
	Template string `yaml:"template"`
	Output   string `yaml:"output"`
}

FileConfig stores parameters for

type ListenConfig

type ListenConfig struct {
	// External interface to monitor changes on
	Iface string

	// Interval stores the time between periodic checks
	Interval int
}

ListenConfig configures the listener

func (*ListenConfig) String

func (l *ListenConfig) String() string

String provides quick info about what the listener does

type LoggingConfig

type LoggingConfig struct {
	// Where are logs written
	Destination string `yaml:"destination"`

	// Log level
	Level string `yaml:"level"`
}

LoggingConfig can reconfigure the program logger

type Zone

type Zone struct {
	// Record to change
	Record string
}

Zone stores the DNS objects that should be updated

Jump to

Keyboard shortcuts

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