aboutsummaryrefslogtreecommitdiff
path: root/middleware/zone.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2016-09-07 11:10:16 +0100
committerGravatar GitHub <noreply@github.com> 2016-09-07 11:10:16 +0100
commitd1f17fa7e061d91aa0af7e1fb959a68db899c812 (patch)
tree0f828a0e7bd8ca86051a721dae48e8c19a0a2f0e /middleware/zone.go
parent684330fd28f65a7a8d1ad01fb4c6c5db78240f29 (diff)
downloadcoredns-d1f17fa7e061d91aa0af7e1fb959a68db899c812.tar.gz
coredns-d1f17fa7e061d91aa0af7e1fb959a68db899c812.tar.zst
coredns-d1f17fa7e061d91aa0af7e1fb959a68db899c812.zip
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
Diffstat (limited to 'middleware/zone.go')
-rw-r--r--middleware/zone.go27
1 files changed, 0 insertions, 27 deletions
diff --git a/middleware/zone.go b/middleware/zone.go
deleted file mode 100644
index 0f3cd0edc..000000000
--- a/middleware/zone.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package middleware
-
-import "github.com/miekg/dns"
-
-type Zones []string
-
-// Matches checks is qname is a subdomain of any of the zones in z. The match
-// will return the most specific zones that matches other. The empty string
-// signals a not found condition.
-func (z Zones) Matches(qname string) string {
- zone := ""
- for _, zname := range z {
- if dns.IsSubDomain(zname, qname) {
- if len(zname) > len(zone) {
- zone = zname
- }
- }
- }
- return zone
-}
-
-// FullyQualify fully qualifies all zones in z.
-func (z Zones) FullyQualify() {
- for i, _ := range z {
- z[i] = dns.Fqdn(z[i])
- }
-}