Fix linter errors

This commit is contained in:
Vladimir Stoilov 2022-07-27 14:27:55 +02:00 committed by Daniel
parent 1e79fedf9b
commit 6a6468418b

View file

@ -20,7 +20,7 @@ const (
configChangeEvent = "config change" configChangeEvent = "config change"
) )
// Helper variables for parsing the input file // Helper variables for parsing the input file.
var ( var (
isCountryCode = regexp.MustCompile("^[A-Z]{2}$").MatchString isCountryCode = regexp.MustCompile("^[A-Z]{2}$").MatchString
isAutonomousSystem = regexp.MustCompile(`^AS[0-9]+$`).MatchString isAutonomousSystem = regexp.MustCompile(`^AS[0-9]+$`).MatchString
@ -95,13 +95,13 @@ func checkAndUpdateFilterList() error {
return nil return nil
} }
// LookupIP checks if the IP address is in a custom filter list // LookupIP checks if the IP address is in a custom filter list.
func LookupIP(ip *net.IP) bool { func LookupIP(ip *net.IP) bool {
_, ok := ipAddressesFilterList[ip.String()] _, ok := ipAddressesFilterList[ip.String()]
return ok return ok
} }
// LookupDomain checks if the Domain is in a custom filter list // LookupDomain checks if the Domain is in a custom filter list.
func LookupDomain(fullDomain string, filterSubdomains bool) bool { func LookupDomain(fullDomain string, filterSubdomains bool) bool {
if filterSubdomains { if filterSubdomains {
// check if domain is in the list and all its subdomains // check if domain is in the list and all its subdomains
@ -113,20 +113,20 @@ func LookupDomain(fullDomain string, filterSubdomains bool) bool {
} }
} }
} else { } else {
//check only if the domain is in the list // check only if the domain is in the list
_, ok := domainsFilterList[fullDomain] _, ok := domainsFilterList[fullDomain]
return ok return ok
} }
return false return false
} }
// LookupASN checks if the Autonomous system number is in a custom filter list // LookupASN checks if the Autonomous system number is in a custom filter list.
func LookupASN(number uint) bool { func LookupASN(number uint) bool {
_, ok := autonomousSystemsFilterList[number] _, ok := autonomousSystemsFilterList[number]
return ok return ok
} }
// LookupCountry checks if the country code is in a custom filter list // LookupCountry checks if the country code is in a custom filter list.
func LookupCountry(countryCode string) bool { func LookupCountry(countryCode string) bool {
_, ok := countryCodesFilterList[countryCode] _, ok := countryCodesFilterList[countryCode]
return ok return ok