From: Michael Tremer Date: Mon, 4 Mar 2024 09:48:19 +0000 (+0000) Subject: importer: Ignore certain country codes X-Git-Tag: 0.9.18~120 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=30d322999719262f805d6f1913515209cca72d59;p=location%2Flibloc.git importer: Ignore certain country codes Signed-off-by: Michael Tremer --- diff --git a/src/scripts/location-importer.in b/src/scripts/location-importer.in index 7689993..18cca65 100644 --- a/src/scripts/location-importer.in +++ b/src/scripts/location-importer.in @@ -48,6 +48,14 @@ VALID_ASN_RANGES = ( (131072, 4199999999), ) +IGNORED_COUNTRIES = set(( + # Formerly Yugoslavia + "YU", + + # Some people use ZZ to say "no country" or to hide the country + "ZZ", +)) + # Configure the CSV parser for ARIN csv.register_dialect("arin", delimiter=",", quoting=csv.QUOTE_ALL, quotechar="\"") @@ -1096,6 +1104,11 @@ class CLI(object): # ... but keep this list distinct... continue + # Ignore certain country codes + if val in IGNORED_COUNTRIES: + log.debug("Ignoring country code '%s'" % val) + continue + # When people set country codes to "UK", they actually mean "GB" if val == "UK": val = "GB"