added support for views
Build and Test / build-test-publish-coverage (push) Failing after 1m36s

This commit is contained in:
2025-02-10 23:09:08 -07:00
parent 3c7493c61d
commit 05c3b0ff0b
5 changed files with 232 additions and 81 deletions
+8 -2
View File
@@ -3,6 +3,7 @@ package netboxdns
import (
"context"
"net/http"
"net/netip"
"time"
"github.com/coredns/coredns/plugin"
@@ -57,8 +58,13 @@ func (netboxdns *NetboxDNS) ServeDNS(
) (int, error) {
state := request.Request{W: respWriter, Req: reqMsg}
qname := state.QName()
reqIP, err := netip.ParseAddr(state.IP())
if err != nil {
return dns.RcodeServerFailure, err
}
family := state.Family()
qtype := fixQType(state.QType(), family)
qtype := state.QType()
// qtype := fixQType(state.QType(), family)
// check if plugin is configured to respond to the requested zone
respondingZone := plugin.Zones(netboxdns.zones).Matches(qname)
@@ -66,7 +72,7 @@ func (netboxdns *NetboxDNS) ServeDNS(
return netboxdns.nextOrFailure(reqContext, respWriter, reqMsg)
}
response, err := netboxdns.lookup(qname, qtype, family)
response, err := netboxdns.lookup(qname, reqIP, qtype, family)
if err != nil {
return dns.RcodeServerFailure, err
}