// Matches checks to see if other is a subdomain (or the same domain) of n. // This method assures that names can be easily and consistently matched. func (n Name) Matches(child string) bool { if dns.Name(n) == dns.Name(child) { return true } return dns.IsSubDomain(string(n), child) }
func (u *staticUpstream) IsAllowedPath(name string) bool { for _, ignoredSubDomain := range u.IgnoredSubDomains { if dns.Name(name) == dns.Name(u.From()) { return true } if middleware.Name(name).Matches(ignoredSubDomain + u.From()) { return false } } return true }
// Name returns the name of the question in the request. Note // this name will always have a closing dot and will be lower cased. After a call Name // the value will be cached. To clear this caching call Clear. func (s *State) Name() string { if s.name != "" { return s.name } s.name = strings.ToLower(dns.Name(s.Req.Question[0].Name).String()) return s.name }
// QName returns the name of the question in the request. func (s *State) QName() string { return dns.Name(s.Req.Question[0].Name).String() }