config

package
v0.6.29 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// the constant that means ALLOW after pasring "allow" or "block"
	ALLOW = ListType(1)
	// the constant that means BLOCK after pasring "allow" or "block"
	BLOCK = ListType(0)

	// the string that represents "allow", all other results are treated as "block"
	ALLOWSTRING = ListString("allow")
	BLOCKSTRING = ListString("block")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppOptions

type AppOptions struct {
	ConfigPath flags.Filename `short:"c" long:"config" description:"Path to Gudgeon configuration file."`
}

type DebugOptions added in v0.3.16

type DebugOptions struct {
	Profile bool `short:"P" long:"profile" description:"Enable profiling at runtime."`
	Debug   bool `short:"d" long:"debug" description:"Force the console log to the debug level"`
}

type GudgeonConfig

type GudgeonConfig struct {
	Home      string             `yaml:"home"`
	Systemd   *GudgeonSystemd    `yaml:"systemd"`
	Storage   *GudgeonStorage    `yaml:"storage"`
	Database  *GudgeonDatabase   `yaml:"database"`
	Metrics   *GudgeonMetrics    `yaml:"metrics"`
	QueryLog  *GudgeonQueryLog   `yaml:"query_log"`
	Network   *GudgeonNetwork    `yaml:"network"`
	Web       *GudgeonWeb        `yaml:"web"`
	Sources   []*GudgeonSource   `yaml:"sources"`
	Resolvers []*GudgeonResolver `yaml:"resolvers"`
	Lists     []*GudgeonList     `yaml:"lists"`
	Groups    []*GudgeonGroup    `yaml:"groups"`
	Consumers []*GudgeonConsumer `yaml:"consumers"`
	// contains filtered or unexported fields
}

func Load

func Load(filename string) (*GudgeonConfig, []string, error)

func (*GudgeonConfig) CacheRoot

func (config *GudgeonConfig) CacheRoot() string

func (*GudgeonConfig) DataRoot added in v0.3.0

func (config *GudgeonConfig) DataRoot() string

func (*GudgeonConfig) GetConsumer added in v0.3.14

func (config *GudgeonConfig) GetConsumer(name string) *GudgeonConsumer

func (*GudgeonConfig) GetGroup added in v0.3.14

func (config *GudgeonConfig) GetGroup(name string) *GudgeonGroup

func (*GudgeonConfig) GetList added in v0.3.14

func (config *GudgeonConfig) GetList(name string) *GudgeonList

func (*GudgeonConfig) GetResolver added in v0.3.14

func (config *GudgeonConfig) GetResolver(name string) *GudgeonResolver

func (*GudgeonConfig) PathToList

func (config *GudgeonConfig) PathToList(list *GudgeonList) string

func (*GudgeonConfig) SessionRoot

func (config *GudgeonConfig) SessionRoot() string

type GudgeonConsumer added in v0.3.14

type GudgeonConsumer struct {
	Name    string          `yaml:"name"`
	Block   bool            `yaml:"block"`
	Groups  []string        `yaml:"groups"`
	Matches []*GudgeonMatch `yaml:"matches"`
}

type GudgeonDatabase added in v0.6.1

type GudgeonDatabase struct {
	// how often the transient query log table is flushed to metrics and indexed query log tables
	Flush string `yaml:"flush"`
}

type GudgeonGroup

type GudgeonGroup struct {
	// name: name of the group
	Name string `yaml:"name"`
	// inherit: list of groups to copy settings from
	Inherit []string `yaml:"inherit"`
	// resolvers: resolvers to use for this group
	Resolvers []string `yaml:"resolvers"`
	// lists: names of blocklists to apply
	Lists []string `yaml:"lists"`
	// tags: tags to use for tag-based matching
	Tags *[]string `yaml:"tags"`
}

groups: ties end-users (consumers) to various lists.

func (*GudgeonGroup) SafeTags added in v0.3.14

func (list *GudgeonGroup) SafeTags() []string

type GudgeonInterface

type GudgeonInterface struct {
	// the IP of the interface. The interface 0.0.0.0 means "all"
	IP string `yaml:"ip"`
	// The port to listen on (on the given interface), defaults to 53
	Port int `yaml:"port"`
	// Should this port listen on TCP? (defaults to the value of Network.TCP which defaults to true)
	TCP *bool `yaml:"tcp"`
	// Should this port listen on UDP? (defaults to the value of Network.UDP which defaults to true)
	UDP *bool `yaml:"udp"`
	// TLS settings
	TLS *GudgeonTLS `yaml:"tls"`
}

network interface information

type GudgeonList

type GudgeonList struct {
	// the name of the list
	Name string `yaml:"name"`

	// the type of the list, requires "allow" or "block", defaults to "block"
	Type string `yaml:"type"`

	// should items in the list be interpreted as **regex only**
	Regex *bool `yaml:"regex"`
	// the tags that relate to the list for tag filtering/processing
	Tags *[]string `yaml:"tags"`
	// the path to the list, remote paths will be downloaded if possible
	Source string `yaml:"src"`
	// contains filtered or unexported fields
}

GudgeonList different types of lists for domains that gudgeon will evaluate (and if they explicitly allow or block the matched entries)

func (*GudgeonList) CanonicalName

func (list *GudgeonList) CanonicalName() string

simple function to get source as name if name is missing

func (*GudgeonList) IsRemote

func (list *GudgeonList) IsRemote() bool

func (*GudgeonList) ParsedType added in v0.6.14

func (list *GudgeonList) ParsedType() ListType

func (*GudgeonList) SafeTags added in v0.3.14

func (list *GudgeonList) SafeTags() []string

func (*GudgeonList) ShortName added in v0.2.2

func (list *GudgeonList) ShortName() string

func (*GudgeonList) String added in v0.6.24

func (list *GudgeonList) String() string

func (*GudgeonList) VerifyAndInit added in v0.6.14

func (list *GudgeonList) VerifyAndInit()

type GudgeonMatch

type GudgeonMatch struct {
	IP    string             `yaml:"ip"`
	Range *GudgeonMatchRange `yaml:"range"`
	Net   string             `yaml:"net"`
}

type GudgeonMatchRange

type GudgeonMatchRange struct {
	Start string `yaml:"start"`
	End   string `yaml:"end"`
}

range: an IP range for consumer matching

type GudgeonMetrics added in v0.3.0

type GudgeonMetrics struct {
	// controls if the entire feature is enabled/disabled
	Enabled *bool `yaml:"enabled"`
	// enables metrics persisting to the db
	Persist *bool `yaml:"persist"`
	// enables detailed stats per client, domain, etc
	Detailed *bool `yaml:"detailed"`
	// how long to keep records
	Duration string `yaml:"duration"`
	// how often to record metrics
	Interval string `yaml:"interval"`
}

type GudgeonNetwork

type GudgeonNetwork struct {
	// Global TLS settings
	TLS *GudgeonTLS `yaml:"tls"`
	// tcp: true when the default for all interfaces is to use tcp
	TCP *bool `yaml:"tcp"`
	// udp: true when the default for all interfaces is to use udp
	UDP *bool `yaml:"udp"`
	// endpoints: list of string endpoints that should have dns
	Interfaces []*GudgeonInterface `yaml:"interfaces"`
}

network: general dns network configuration

type GudgeonOptions

type GudgeonOptions struct {
	// explicit app group
	AppOptions AppOptions `group:"Application Options"`

	// debug/performance/profiling options
	DebugOptions DebugOptions `group:"Debugging/Profiling Options"`

	// emulate help flag with direct support for accessing it
	HelpOptions HelpOptions `group:"Help Options"`
}

func Options

func Options(longVersion string) (GudgeonOptions, error)

type GudgeonQueryLog added in v0.3.0

type GudgeonQueryLog struct {
	// controls if the entire feature is enabled/disabled
	Enabled *bool `yaml:"enabled"`
	// enables persisting queries to the log (to make them searchable)
	Persist *bool `yaml:"persist"`
	// how long to keep the queries for
	Duration string `yaml:"duration"`
	// if we should also log to stdout
	Stdout *bool `yaml:"stdout"`
	// if we should log to a file, the path to that file (does not rotate automatically)
	File string `yaml:"file"`
	// reverse lookup using query engine
	ReverseLookup *bool `yaml:"lookup"`
	// add mdns/zeroconf/bonjour capability to lookup
	MdnsLookup *bool `yaml:"mdns"`
	// add netbios capability to lookup
	NetbiosLookup *bool `yaml:"netbios"`
}

type GudgeonResolver

type GudgeonResolver struct {
	// name of the resolver
	Name string `yaml:"name"`
	// domains to operate on
	Domains []string `yaml:"domains"`
	// domains to skip
	SkipDomains []string `yaml:"skip"`
	// search domains, will retry resolution using these subdomains if the domain is not found
	Search []string `yaml:"search"`
	// manual hosts
	Hosts []string `yaml:"hosts"`
	// sources (described via string)
	Sources []string `yaml:"sources"`
}

a resolver is composed of a list of sources to get DNS information from

type GudgeonRoot

type GudgeonRoot struct {
	Config *GudgeonConfig `yaml:"gudgeon"`
}

type GudgeonSource added in v0.6.5

type GudgeonSource struct {
	// name that would be in the source list for a resolver
	Name string `yaml:"name"`
	// specs of children resolvers (same as a simple source spec)
	Specs []string `yaml:"spec"`
	// should the entries in the spec list be load balanced (default: false)
	LoadBalance bool `yaml:"balance"`
	// source specific options to allow further configuration of sources
	Options map[string]interface{} `yaml:"options"`
}

provides more configuration options and details for sources beyond the simple source specification

type GudgeonStorage added in v0.3.13

type GudgeonStorage struct {
	// rule storage is used by the rule storage engine to decide which implementation to use
	// values are like 'memory', 'sqlite', 'hash32', etc
	RuleStorage string `yaml:"rules"`
	// you can enable/disable the cache here, default is to enable
	CacheEnabled *bool `yaml:"cache"`
}

GudgeonStorage defines the different storage types for persistent/session data

type GudgeonSystemd added in v0.6.11

type GudgeonSystemd struct {
	// should we accept ports from systemd?
	Enabled *bool `yaml:"enabled"`
	// ports that will be interpreted as "dns" ports
	DnsPorts *[]uint32 `yaml:"dns"` // default 53
	// ports that will be interpreted as "http" ports
	HttpPorts *[]uint32 `yaml:"http"` // default 80, 8080
}

type GudgeonTLS added in v0.1.7

type GudgeonTLS struct {
	Enabled bool `yaml:"enabled"`
}

type GudgeonWeb added in v0.2.2

type GudgeonWeb struct {
	Enabled bool   `yaml:"enabled"`
	Address string `yaml:"address"`
	Port    int    `yaml:"port"`
}

type HelpOptions

type HelpOptions struct {
	Help    bool `short:"h" long:"help" group:"Help options" description:"Show this help message."`
	Version bool `short:"v" long:"version" description:"Print the version of the software."`
}

type ListString added in v0.6.14

type ListString string

type ListType added in v0.6.14

type ListType uint8

Jump to

Keyboard shortcuts

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