First commit

This commit is contained in:
Miek Gieben
2016-03-18 20:57:35 +00:00
commit 3ec0d9fe6b
131 changed files with 15193 additions and 0 deletions

21
middleware/zone.go Normal file
View File

@@ -0,0 +1,21 @@
package middleware
import "strings"
type Zones []string
// Matches checks to see if other matches p.
// 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 strings.HasSuffix(qname, zname) {
if len(zname) > len(zone) {
zone = zname
}
}
}
return zone
}