mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 18:23:13 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			536 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			536 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package middleware
 | |
| 
 | |
| import (
 | |
| 	"strings"
 | |
| 
 | |
| 	"github.com/miekg/dns"
 | |
| )
 | |
| 
 | |
| // Name represents a domain name.
 | |
| type Name string
 | |
| 
 | |
| // Matches checks to see if other matches n.
 | |
| //
 | |
| // Name matching will probably not always be a direct
 | |
| // comparison; this method assures that names can be
 | |
| // easily and consistently matched.
 | |
| 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)))
 | |
| }
 |