config

package
Version: v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2017 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteConfig

func WriteConfig(outputFile string, configData *HostsConfig) error

WriteConfig saves a HostsConfig to a file

Types

type Host

type Host struct {
	Current string            `json:"current,omitempty"`
	Options map[string]string `json:"options,omitempty"`
}

Host defines the data associated with a hostname

type HostsConfig

type HostsConfig struct {
	LocalHostnames []string            `json:"localHostnames,omitempty"`
	IPv6Defaults   bool                `json:"ipV6Defaults,omitempty"`
	Hosts          map[string]Host     `json:"hosts,omitempty"`
	GlobalIPs      map[string]string   `json:"globalIPs,omitempty"`
	Groups         map[string][]string `json:"groups,omitempty"`
}

HostsConfig defines the structure of the hosts config file

func BuildConfigFromHosts

func BuildConfigFromHosts(hosts map[string][]string) *HostsConfig

BuildConfigFromHosts builds a config from a map of hostnames to ips

func LoadConfigFromFile

func LoadConfigFromFile(fileName string) (*HostsConfig, error)

LoadConfigFromFile loads a HostsConfig from a file

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL