mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
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:
committed by
Pat Moroney
parent
e47d881461
commit
4b402e000d
@@ -12,10 +12,19 @@ import (
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
func (h *Hostsfile) parseReader(r io.Reader) { h.hmap = h.parse(r, h.inline) }
|
||||
func (h *Hostsfile) parseReader(r io.Reader) {
|
||||
h.hmap = h.parse(r)
|
||||
}
|
||||
|
||||
func TestLookupA(t *testing.T) {
|
||||
h := Hosts{Next: test.ErrorHandler(), Hostsfile: &Hostsfile{Origins: []string{"."}}}
|
||||
h := Hosts{
|
||||
Next: test.ErrorHandler(),
|
||||
Hostsfile: &Hostsfile{
|
||||
Origins: []string{"."},
|
||||
hmap: newHostsMap(),
|
||||
options: newOptions(),
|
||||
},
|
||||
}
|
||||
h.parseReader(strings.NewReader(hostsExample))
|
||||
|
||||
ctx := context.TODO()
|
||||
@@ -90,4 +99,6 @@ const hostsExample = `
|
||||
::1 localhost localhost.domain
|
||||
10.0.0.1 example.org
|
||||
::FFFF:10.0.0.2 example.com
|
||||
reload 5s
|
||||
timeout 3600
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user