provider/domain_filter.go
func (df DomainFilter) Match(domain string) bool {
	// return always true, if not filter is specified
	if len(df.filters) == 0 {
		return true
	}

	for _, filter := range df.filters {
		strippedDomain := strings.TrimSuffix(domain, ".")

		if filter == "" {
			return true
		} else if strings.HasPrefix(filter, ".") && strings.HasSuffix(strippedDomain, filter) {
			return true
		} else if strings.Count(strippedDomain, ".") == strings.Count(filter, ".") {
			if strippedDomain == filter {
				return true
			}
		} else if strings.HasSuffix(strippedDomain, "."+filter) {
			return true
		}
	}

	return false
}
func (df DomainFilter) Match(domain string) bool {
	// return always true, if not filter is specified
	if len(df.filters) == 0 {
		return true
	}

	for _, filter := range df.filters {
		strippedDomain := strings.TrimSuffix(domain, ".")

		if filter == "" {
			return true
		} else if strings.HasPrefix(filter, ".") && strings.HasSuffix(strippedDomain, filter) {
			return true
		} else if strings.Count(strippedDomain, ".") == strings.Count(filter, ".") {
			if strippedDomain == filter {
				return true
			}
		} else if strings.HasSuffix(strippedDomain, "."+filter) {
			return true
		}
	}

	return false
}
// Match checks whether a domain can be found in the DomainFilter.