// ParsePublicSuffixCSV parse a CSV string into a cleaned slice of strings func ParsePublicSuffixCSV(csv string, accepted map[string]bool, includeTLDs bool) ([]string, error) { psl := wordlist.FromCSV(csv) for _, ps := range psl { _, ok := accepted[ps] if !ok { return nil, fmt.Errorf("Public Suffix %q is unknown", ps) } } if includeTLDs { for ps := range accepted { if !strings.Contains(ps, ".") { psl = append(psl, ps) } } } psl = wordlist.RemoveDuplicates(psl) sort.Strings(psl) return psl, nil }
// ParseDNSCSV parse a CSV string into a cleaned slice of strings func ParseDNSCSV(csv string) []string { psl := wordlist.FromCSV(csv) psl = wordlist.RemoveDuplicates(psl) sort.Strings(psl) return psl }