diff --git a/NETWORKING.md b/NETWORKING.md index 91a4ce6516..a86c27956d 100644 --- a/NETWORKING.md +++ b/NETWORKING.md @@ -360,7 +360,7 @@ CREATE TABLE ipv6_mapping latitude REAL NOT NULL, -- Latitude of this IP range longitude REAL NOT NULL, -- Longitude of this IP range country_code TEXT NOT NULL -- 2-letter country code -) +); ``` For initialization of `ip_mapping` table, check [this script](tools/generate-ip-mappings.py). diff --git a/tools/generate-countries-table.py b/tools/generate-countries-table.py index a953704d30..a7a714d4d4 100755 --- a/tools/generate-countries-table.py +++ b/tools/generate-countries-table.py @@ -6,7 +6,7 @@ # .mode csv # .headers off # .separator ";" -# .import `full path to countries.csv` `v(database_version)_countries` +# .import 'full path to countries.csv' 'v(database_version)_countries' # import csv diff --git a/tools/generate-ip-mappings.py b/tools/generate-ip-mappings.py index 5f3fd86d90..0967ba6bdd 100755 --- a/tools/generate-ip-mappings.py +++ b/tools/generate-ip-mappings.py @@ -4,8 +4,8 @@ # in sqlite3 terminal: # # .mode csv -# .import `full path to ipv4.csv` ip_mapping -# .import `full path to ipv6.csv` ipv6_mapping +# .import 'full path to ipv4.csv' ip_mapping +# .import 'full path to ipv6.csv' ipv6_mapping # # For query by ip: @@ -27,8 +27,8 @@ def ipv62int64(addr): hi, lo = struct.unpack('!QQ', socket.inet_pton(socket.AF_INET6, addr)) return hi -CSV_WEB_LINK = 'https://download.db-ip.com/free/dbip-city-lite-2020-01.csv.gz' -CSV_FILE = 'dbip-city-lite-2020-01.csv' +CSV_WEB_LINK = 'https://download.db-ip.com/free/dbip-city-lite-2025-01.csv.gz' +CSV_FILE = 'dbip-city-lite-2025-01.csv' if not os.path.exists(CSV_FILE): print("File = {} does not exist. Download it from = {} ".format(CSV_FILE, CSV_WEB_LINK)) @@ -42,7 +42,7 @@ def ipv62int64(addr): if row[3] == "ZZ": continue # Skip empty latitude and longitude - if row[6] is "" or row[7] is "": + if row[6] == "" or row[7] == "": continue if row[0].find(':') == -1: