fix: MMDB中文路径解决方案 + 聚类优先使用最新GeoIP数据
- geoip.py: maxminddb C库不支持Windows中文路径,复制MMDB到ASCII临时目录 - views.py: _cluster_network 优先用 geoip_lookup()(MMDB) 而非上传时缓存(text) - 效果: IP地理坐标从 ~55城市粗定位 → 全球百万级精确城市定位 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -792,11 +792,12 @@ def _cluster_network(entry: dict, df: pl.DataFrame, meta: dict,
|
||||
logger.info('Network clustering: %d unique IPs from %d records', n_nodes, len(df))
|
||||
|
||||
# ── 2. GeoIP 解析所有 IP ───────────────────────────────────────────
|
||||
# MMDB优先(高精度),upload时的geo_cache兜底(低精度文本回退)
|
||||
node_geo = {} # ip → {lat, lon, city, country, isp, org}
|
||||
for ip in unique_ips:
|
||||
info = geo_cache.get(ip)
|
||||
info = geoip_lookup(ip) # 优先用当前加载的MMDB数据库
|
||||
if not info:
|
||||
info = geoip_lookup(ip)
|
||||
info = geo_cache.get(ip) # 回退到上传时的缓存
|
||||
if info:
|
||||
node_geo[ip] = info
|
||||
|
||||
|
||||
Reference in New Issue
Block a user