Allow rewriting of the the name of the query as well. And improve

the docs a little.
This commit is contained in:
Miek Gieben
2016-03-20 10:44:03 +00:00
parent 41d5d40a31
commit e954332b9f
3 changed files with 24 additions and 7 deletions

View File

@@ -1,6 +1,10 @@
package middleware
import "strings"
import (
"strings"
"github.com/miekg/dns"
)
// Name represents a domain name.
type Name string
@@ -13,3 +17,8 @@ type Name string
func (n Name) Matches(other string) bool {
return strings.HasSuffix(string(n), other)
}
// Normalize lowercases and makes n fully qualified.
func (n Name) Normalize() string {
return strings.ToLower(dns.Fqdn(string(n)))
}