Add best-effort geolocation to the IP lookup from geojs and DB-IP City Lite (closes #239)
check / check (push) Canceled after 1m16s
check / check (push) Canceled after 1m16s
Each result gains `geo`. One request to geojs carries every address, 1 second in all. On a timeout, an error or an answer with no country, city or coordinates, the lookup reads DB-IP City Lite, downloaded monthly into the state directory. geojs answers stay in memory (250,000, least recently used dropped) and in a new `cache.db` table for 7 days. Judgement call: a reserved address goes to neither source, and its `geo` is null. Judgement call: `updated` for DB-IP is when the copy was downloaded. Deviation: the cache is SQLite, by sneak's words. Model: opus-5-5
This commit is contained in:
1 parent
0cbd9cd943
commit
c5bd4a63d0
16 files changed
+2372
-22
No files matched your search
@@ -6,3 +6,19 @@ CREATE TABLE IF NOT EXISTS hostnames (
|
||||
names TEXT NOT NULL,
|
||||
expires_at INTEGER NOT NULL
|
||||
);
|
||||
|
||||
-- geolocations holds the answers of geojs. A part geojs does not know is NULL.
|
||||
-- fetched_at is in seconds since 1970.
|
||||
CREATE TABLE IF NOT EXISTS geolocations (
|
||||
address TEXT PRIMARY KEY,
|
||||
country_code TEXT,
|
||||
country TEXT,
|
||||
continent_code TEXT,
|
||||
region TEXT,
|
||||
city TEXT,
|
||||
latitude REAL,
|
||||
longitude REAL,
|
||||
accuracy_radius_km INTEGER,
|
||||
time_zone TEXT,
|
||||
fetched_at INTEGER NOT NULL
|
||||
);
|
||||
Reference in new issue
Block a user