aboutsummaryrefslogtreecommitdiff
path: root/middleware/proxy/lookup.go
diff options
context:
space:
mode:
Diffstat (limited to 'middleware/proxy/lookup.go')
-rw-r--r--middleware/proxy/lookup.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/middleware/proxy/lookup.go b/middleware/proxy/lookup.go
index 22a0c77d6..e2a3a0c77 100644
--- a/middleware/proxy/lookup.go
+++ b/middleware/proxy/lookup.go
@@ -7,7 +7,8 @@ import (
"sync/atomic"
"time"
- "github.com/miekg/coredns/middleware"
+ "github.com/miekg/coredns/request"
+
"github.com/miekg/dns"
)
@@ -54,18 +55,19 @@ func New(hosts []string) Proxy {
// Lookup will use name and type to forge a new message and will send that upstream. It will
// set any EDNS0 options correctly so that downstream will be able to process the reply.
// Lookup is not suitable for forwarding request. Ssee for that.
-func (p Proxy) Lookup(state middleware.State, name string, tpe uint16) (*dns.Msg, error) {
+func (p Proxy) Lookup(state request.Request, name string, tpe uint16) (*dns.Msg, error) {
req := new(dns.Msg)
req.SetQuestion(name, tpe)
state.SizeAndDo(req)
+
return p.lookup(state, req)
}
-func (p Proxy) Forward(state middleware.State) (*dns.Msg, error) {
+func (p Proxy) Forward(state request.Request) (*dns.Msg, error) {
return p.lookup(state, state.Req)
}
-func (p Proxy) lookup(state middleware.State, r *dns.Msg) (*dns.Msg, error) {
+func (p Proxy) lookup(state request.Request, r *dns.Msg) (*dns.Msg, error) {
var (
reply *dns.Msg
err error
@@ -84,9 +86,9 @@ func (p Proxy) lookup(state middleware.State, r *dns.Msg) (*dns.Msg, error) {
atomic.AddInt64(&host.Conns, 1)
if state.Proto() == "tcp" {
- reply, err = middleware.Exchange(p.Client.TCP, r, host.Name)
+ reply, _, err = p.Client.TCP.Exchange(r, host.Name)
} else {
- reply, err = middleware.Exchange(p.Client.UDP, r, host.Name)
+ reply, _, err = p.Client.UDP.Exchange(r, host.Name)
}
atomic.AddInt64(&host.Conns, -1)