Documentation
¶
Overview ¶
Package cfg contains the configuration and related global states.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddrT ¶
AddrT is an IP or hostname
type ConfigT ¶
type ConfigT struct { ControlListen *AddrT DNSListen *AddrT DNSForward *AddrT HTTPListen *AddrT HTTPSListen *AddrT RootCert string RootKey string User *UserT Chroot string CacheHosts int64 CacheDNS int64 Color bool Verbose int // A list of the various sources; this only contains the hosts defined with // the "host" keyword in the config. Hostlists [][]string Unhostlists [][]string Regexplists [][]string Unregexplists [][]string Hosts []string Unhosts []string Regexps []string Unregexps []string Surrogates [][]string }
ConfigT holds the configuration.
var Config ConfigT
Config of the application.
func (ConfigT) ChrootDir ¶
ChrootDir prefixes a path with the chroot dir.
func (*ConfigT) Compile ¶
func (c *ConfigT) Compile()
Compile all the sources in one file, saves some memory and makes lookups a bit faster
type HostList ¶
HostList is a static hosts added with hostlist/host. The key is the hostname, the (optional) value is a surrogate script to serve.
var ( // Hosts are all the loaded hosts. Hosts HostList )
type OverrideList ¶
OverrideList are all the hosts the user told us to override.
The value is expiry timestamp.
var Override OverrideList
Override these hosts and regexps.
type RegexpList ¶
RegexpList is a list of all regexp blocks.
Pre-compiling the surrogate scripts isn't possible here.
var ( // Regexps are all the loaded regexps. Regexps RegexpList )
func (*RegexpList) Match ¶
func (l *RegexpList) Match(name string) bool
Match the name against all the regexps.
type SurrogateEntry ¶
SurrogateEntry will serve the script if the regexp matches.
type SurrogateList ¶
SurrogateList is the list of surrogate scripts to use.
var ( // Surrogates are all the surrogate scripts. Surrogates SurrogateList )
func (*SurrogateList) Add ¶
func (l *SurrogateList) Add(scripts ...[]string)
Add new surrogates. The first list entry is the host regexp, the second the script.
func (*SurrogateList) Find ¶
func (l *SurrogateList) Find(host string) (script string, success bool)
Find a surrogate.