예제 #1
0
파일: name.go 프로젝트: yuewko/coredns
// 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)
}
예제 #2
0
파일: upstream.go 프로젝트: yuewko/coredns
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
}
예제 #3
0
파일: state.go 프로젝트: yuewko/coredns
// 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
}
예제 #4
0
파일: state.go 프로젝트: yuewko/coredns
// QName returns the name of the question in the request.
func (s *State) QName() string { return dns.Name(s.Req.Question[0].Name).String() }