middleware/proxy: implement Exchanger (#480)
By defining and using an proxy.Exchanger interface we make the proxy more generic and we can then fold back httproxy into proxy. This overrides #463 and #473 and should make futures extensions rather trivial * Add docs that talk about `protocol` and how to set it. * middleware/proxy: rename New to NewLookup It's used as a Lookup mechanism not as a completely new proxy, reflect that in the name. * Set maxfails to 3 by default when looking up names. Most of the changes have been copied from https://github.com/johnbelamaric/coredns/pull/1/files
This commit is contained in:
parent
a6d232a622
commit
52e01264e8
25 changed files with 140 additions and 61 deletions
|
@ -42,7 +42,7 @@ func TestAuto(t *testing.T) {
|
|||
|
||||
log.SetOutput(ioutil.Discard)
|
||||
|
||||
p := proxy.New([]string{udp})
|
||||
p := proxy.NewLookup([]string{udp})
|
||||
state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)}
|
||||
|
||||
resp, err := p.Lookup(state, "www.example.org.", dns.TypeA)
|
||||
|
@ -108,7 +108,7 @@ func TestAutoNonExistentZone(t *testing.T) {
|
|||
}
|
||||
defer i.Stop()
|
||||
|
||||
p := proxy.New([]string{udp})
|
||||
p := proxy.NewLookup([]string{udp})
|
||||
state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)}
|
||||
|
||||
resp, err := p.Lookup(state, "example.org.", dns.TypeA)
|
||||
|
@ -155,7 +155,7 @@ func TestAutoAXFR(t *testing.T) {
|
|||
|
||||
time.Sleep(1100 * time.Millisecond) // wait for it to be picked up
|
||||
|
||||
p := proxy.New([]string{udp})
|
||||
p := proxy.NewLookup([]string{udp})
|
||||
m := new(dns.Msg)
|
||||
m.SetAxfr("example.org.")
|
||||
state := request.Request{W: &test.ResponseWriter{}, Req: m}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue