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:
Miek Gieben
2016-09-07 11:10:16 +01:00
committed by GitHub
parent 684330fd28
commit d1f17fa7e0
90 changed files with 680 additions and 1037 deletions

View File

@@ -1,9 +1,6 @@
package tree
import (
"github.com/miekg/coredns/middleware"
"github.com/miekg/dns"
)
import "github.com/miekg/dns"
type Elem struct {
m map[uint16][]dns.RR
@@ -91,8 +88,8 @@ func (e *Elem) Delete(rr dns.RR) (empty bool) {
return
}
// Less is a tree helper function that calls middleware.Less.
func Less(a *Elem, name string) int { return middleware.Less(name, a.Name()) }
// Less is a tree helper function that calls less.
func Less(a *Elem, name string) int { return less(name, a.Name()) }
// Assuming the same type and name this will check if the rdata is equal as well.
func equalRdata(a, b dns.RR) bool {