func (c *Config) DisplayErrors(logger log15.Logger) {
	c.protect.RLock()
	defer c.protect.RUnlock()
	for _, e := range c.errors {
		logger.Error(e.Error())
	}
}
DisplayErrors is a helper function to log the output of all config errors to
the standard logger.
package config
import (
	"sync"
	"gopkg.in/inconshreveable/log15.v2"
)
const (
	defaultIrcPort = uint16(6667)
	defaultStoreFile = "./store.db"
	defaultLogLevel = "info"
	defaultJoinDelay = uint(5)
	defaultFloodLenPenalty = uint(120)
	defaultFloodTimeout = 10.0
	defaultFloodStep = 2.0
	defaultKeepAlive = 60.0
	defaultReconnectTimeout = uint(20)
	defaultPrefix = '.'
)
const (
	fmtErrInvalid          = "config(%v): Invalid %v, given: %v"
	fmtErrMissing          = "config(%v): Requires %v, but nothing was given."
	fmtErrNetworkNotFound  = "config: Network not found, given: %v"
	errMsgNetworksRequired = "config: At least one network is required."
	errMsgDuplicateNetwork = "config: Network names must be unique, use .Host()"
)
type Config struct {
	values mp
	errors   errList
	filename string
	protect  sync.RWMutex
}
func New() *Config {
	c := &Config{}
	c.clear()
	return c
}
func (c *Config) Clear() {
	c.protect.Lock()
	defer c.protect.Unlock()
	c.clear()
}
func (c *Config) clear() {
	c.values = make(map[string]interface{})
	c.errors = nil
	c.filename = ""
}
func (c *Config) Clone() *Config {
	c.protect.RLock()
	defer c.protect.RUnlock()
	nc := New()
	copyMap(nc.values, c.values)
	return nc
}
func (c *Config) Replace(newConfig *Config) *Config {
	c.protect.Lock()
	defer c.protect.Unlock()
	newConfig.protect.RLock()
	defer newConfig.protect.RUnlock()
	c.values = make(map[string]interface{})
	copyMap(c.values, newConfig.values)
	return c
}
func (c *Config) Network(name string) *NetCTX {
	c.protect.RLock()
	defer c.protect.RUnlock()
	if len(name) == 0 {
		return &NetCTX{&c.protect, nil, c.values}
	} else {
		if nets := c.values.get("networks"); nets != nil {
			if net := nets.get(name); net != nil {
				return &NetCTX{&c.protect, c.values, net}
			}
		}
		return nil
	}
}
func (c *Config) Networks() []string {
	c.protect.RLock()
	defer c.protect.RUnlock()
	nets := c.values.get("networks")
	if nets == nil {
		return nil
	}
	rets := make([]string, 0)
	for key, _ := range nets {
		rets = append(rets, key)
	}
	return rets
}
func (c *Config) Ext(name string) *ExtNormalCTX {
	c.protect.RLock()
	defer c.protect.RUnlock()
	parent := c.values.get("ext")
	if exts := c.values.get("exts"); exts != nil {
		if ext := exts.get(name); ext != nil {
			return &ExtNormalCTX{&ExtCTX{&c.protect, parent, ext}}
		}
	}
	return nil
}
func (c *Config) ExtGlobal() *ExtGlobalCTX {
	c.protect.RLock()
	defer c.protect.RUnlock()
	if ext := c.values.get("ext"); ext != nil {
		return &ExtGlobalCTX{&ExtCTX{&c.protect, nil, ext}}
	}
	ext := make(map[string]interface{})
	c.values["ext"] = ext
	return &ExtGlobalCTX{&ExtCTX{&c.protect, nil, ext}}
}
func (c *Config) Exts() []string {
	c.protect.RLock()
	defer c.protect.RUnlock()
	exts := c.values.get("exts")
	if exts == nil {
		return nil
	}
	rets := make([]string, 0)
	for key := range exts {
		rets = append(rets, key)
	}
	return rets
}