mirror of
https://github.com/coredns/coredns.git
synced 2025-12-07 19:05:19 -05:00
Cleanup: put middleware helper functions in pkgs (#245)
Move all (almost all) Go files in middleware into their own packages. This makes for better naming and discoverability. Lot of changes elsewhere to make this change. The middleware.State was renamed to request.Request which is better, but still does not cover all use-cases. It was also moved out middleware because it is used by `dnsserver` as well. A pkg/dnsutil packages was added for shared, handy, dns util functions. All normalize functions are now put in normalize.go
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"log"
|
||||
|
||||
"github.com/miekg/coredns/middleware"
|
||||
"github.com/miekg/coredns/request"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
@@ -12,7 +13,7 @@ import (
|
||||
// isNotify checks if state is a notify message and if so, will *also* check if it
|
||||
// is from one of the configured masters. If not it will not be a valid notify
|
||||
// message. If the zone z is not a secondary zone the message will also be ignored.
|
||||
func (z *Zone) isNotify(state middleware.State) bool {
|
||||
func (z *Zone) isNotify(state request.Request) bool {
|
||||
if state.Req.Opcode != dns.OpcodeNotify {
|
||||
return false
|
||||
}
|
||||
@@ -56,7 +57,7 @@ func notify(zone string, to []string) error {
|
||||
|
||||
func notifyAddr(c *dns.Client, m *dns.Msg, s string) error {
|
||||
for i := 0; i < 3; i++ {
|
||||
ret, err := middleware.Exchange(c, m, s)
|
||||
ret, _, err := c.Exchange(m, s)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user