corrects incorrectly scoped continue
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
@ -28,21 +29,30 @@ func cleanBadDomains(domains []string) []string {
|
|||||||
// remove duplicates
|
// remove duplicates
|
||||||
domains = removeDuplicateStr(domains)
|
domains = removeDuplicateStr(domains)
|
||||||
|
|
||||||
|
fmt.Printf("Processing: \n")
|
||||||
|
|
||||||
for _, domain := range domains {
|
for _, domain := range domains {
|
||||||
// removing trailing dots
|
// removing trailing dots
|
||||||
domain = regexp.MustCompile(`\.$`).ReplaceAllString(domain, "")
|
domain = regexp.MustCompile(`\.$`).ReplaceAllString(domain, "")
|
||||||
|
|
||||||
// skip domains that are too long
|
// skip domains that are too long
|
||||||
if len([]rune(domain)) > 230 {
|
if len([]rune(domain)) > 230 {
|
||||||
|
fmt.Printf("-")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip domains that are allowed
|
// skip domains that are allowed
|
||||||
|
var skip bool
|
||||||
for _, allowRegex := range cfg.ConfigFile.AllowLists {
|
for _, allowRegex := range cfg.ConfigFile.AllowLists {
|
||||||
if regexp.MustCompile(allowRegex).MatchString(domain) {
|
if regexp.MustCompile(allowRegex).MatchString(domain) {
|
||||||
|
skip = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if skip {
|
||||||
|
fmt.Printf(".")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// add domain
|
// add domain
|
||||||
cleanDomains = append(cleanDomains, domain)
|
cleanDomains = append(cleanDomains, domain)
|
||||||
|
Reference in New Issue
Block a user