plugin/hosts provide more configuration flexibility (#2535)

* plugin/hosts provide more configuration flexibility

This patch adds few features to the host plugin
 * no-reverse (both as first argument on the plugin line and inline)
   disable the automatic generation of reserve entries for hosts
 * ttl <duration> (inline only atm)
   allows to change the default ttl (default 5 minutes)
 * reload <duration> (inline only atm)
   allows to change the reloading interval (default 5s)

* plugin/hosts remove superfluous parameters to parse
This commit is contained in:
Thomas Mangin
2019-02-12 16:09:33 +00:00
committed by Pat Moroney
parent e47d881461
commit 4b402e000d
6 changed files with 163 additions and 70 deletions

View File

@@ -12,7 +12,11 @@ import (
)
func testHostsfile(file string) *Hostsfile {
h := &Hostsfile{Origins: []string{"."}}
h := &Hostsfile{
Origins: []string{"."},
hmap: newHostsMap(),
options: newOptions(),
}
h.parseReader(strings.NewReader(file))
return h
}