cfg

package
v0.0.0-...-a7ebeb7 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeHost

func MakeHost(h rt.Hosts, d string, cdir, imgdir string) *bytes.Buffer

MakeHost returns a subnet string

Types

type Cfg

type Cfg struct {
	Core  CoreCfg             `json:"core"`
	Hosts map[string]rt.Hosts `json:"hosts"`
}

Cfg type holds core DHCP ISC configuration

func NewCfg

func NewCfg() Cfg

NewCfg returns a new empty Cfg struct

func (*Cfg) APIResponder

func (c *Cfg) APIResponder(cachesend chan rt.Envelope, fname string, wg *sync.WaitGroup) (recvch chan rt.Envelope, finish chan struct{})

APIResponder is a GR that responds to REST API calls Note, the cache doesn't need to be locked. If we try, we'll get deadlocked.

func (Cfg) CreateDHCPd

func (c Cfg) CreateDHCPd() (string, error)

CreateDHCPd is a func that returns a stringified version of the cache for the DHCPd configuration

func (Cfg) CreateIfaceSetting

func (c Cfg) CreateIfaceSetting() (string, error)

CreateIfaceSetting is a func that returns a stringified version of the cache for the DHCPd configuration func (c Cfg) CreateIfaceSetting(send chan rt.Envelope) (string, error) {

func (Cfg) MakeSubnet

func (c Cfg) MakeSubnet() *bytes.Buffer

MakeSubnet returns a subnet string

func (*Cfg) Parse

func (c *Cfg) Parse(cfgfile string) error

Parse unmarshalls the TOML based configuration text file on to c

func (*Cfg) Save

func (c *Cfg) Save(cfgfile string) error

Save marshals and saves the content of c The REST API handler is blocking (Go routine single buffered channel), so no need to block here func (c *Cfg) Save(cfgfile string, send chan rt.Envelope) error {

func (*Cfg) String

func (c *Cfg) String(send chan rt.Envelope) (string, error)

String gets the map of hosts and combines it, then returns the data

type CoreCfg

type CoreCfg struct {
	HTTPUser            string   `json:"httpuser"`
	HTTPPasswd          string   `json:"httppasswd"`
	ServerURL           string   `json:"serverurl"`
	ServerPort          int      `json:"srverport"`
	HTTPConfigsLocation string   `json:"-"` // Directory for serving configurations "configs"
	HTTPImagesLocation  string   `json:"-"` // Directory for serving configurations "images"
	FileConfigsLocation string   `json:"-"` // Directory for generating configurations "./configs"
	FileImagesLocation  string   `json:"-"` // Directory for generating configurations "./configs"
	DHCPDPath           string   `json:"-"` // /etc/dhcpd/dhcpd.conf
	DHCPPath            string   `json:"-"` // /etc/default/isc-dhcp-server
	DHCPIface           string   `json:"dhcpiface" dhcpd:"INTERFACESv4"`
	DomainName          string   `json:"domainname" dhcpd:"option domain-name "`
	DNSServers          []string `json:"dnservers" dhcpd:"option domain-name-servers"`
	DefaultLease        int      `json:"defaultlease" dhcpd:"default-lease-time "`
	MaxLease            int      `json:"maxlease" dhcpd:"max-lease-time "`
	Subnet              string   `json:"subnet" dhcpd:"subnet"`
	SubnetMask          string   `json:"subnetmask" dhcpd:"netmask"`
	NonCfgRangeLow      string   `json:"noncfgrangelow"`
	NonCfgRangeHigh     string   `json:"noncfgrangehigh"`
	SubnetRouter        string   `json:"subnetrouter"  dhcpd:"option routers"`
	TransferMode        string   `toml:"-" json:"transfermode" dhcpd:"option ezjunosztp.transfer-mode"`
	FileServer          string   `json:"fileserver" dhcpd:"option ezjunosztp-file-server"`
	NTPServers          []string `json:"ntpservers" dhcpd:"option ntp-servers"`
}

CoreCfg holds core info

Jump to

Keyboard shortcuts

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