{% extends "base.html" %} {% block title %}GeoIP 地图 - Squid Manager{% endblock %} {% block head %} {% endblock %} {% block content %}
本页地理位置查询使用
{{ data_source }}。
{% if use_online %}
默认走 ip-api.com 免费公共 API (45 req/min,无需 key)。
如果你需要更稳定/更高速的查询,可以下载 MaxMind
GeoLite2-City
的 .mmdb 文件并通过 AppConfig(geoip_mmdb) 配置离线路径。
{% else %}
已配置离线数据库 {{ db_path }},优先使用本地查询,不再发送外网请求。
{% endif %}
当前解析日志中没有客户端 IP。请确认 access.log 路径与权限。
{% else %}Top {{ total_clients }} 个客户端均为私有地址,或 ip-api.com 暂时不可达。 详见下方的状态表。
{% endif %}| # | 客户端 IP | 国家 | 城市 | ISP/ASN | 请求数 | 流量 | 状态 |
|---|---|---|---|---|---|---|---|
| {{ loop.index }} | {{ r.ip }} |
{% if r.country_name %} {{ r.country_name }} {% if r.country %}{{ r.country }}{% endif %} {% else %} {% endif %} | {{ r.city or '-' }} {% if r.region %}{% endif %} |
{{ r.isp or '-' }}
{% if r.asn %}{{ r.asn }}{% endif %}
|
{{ '{:,}'.format(r.count) }} | {{ format_bytes(r.bytes) }} | {% if not r.error %} 已解析 {% elif r.error == 'private IP' %} 私有 IP {% else %} ⚠ 查询失败 {% endif %} |
暂无客户端数据。
同样数据以 JSON 形式提供,便于脚本与外部仪表盘接入:
| 路径 | 说明 | 返回 |
|---|---|---|
GET /api/geoip/clients |
Top 50 客户端 IP + GeoIP | {ok, source:"clients", backend, rows:[…]} |
GET /api/geoip/hosts |
Top 50 目标主机 (先解析为 IP 再查询) | {ok, source:"hosts", backend, rows, placed, skipped} |
GET /geoip |
本页 (Top 20) | HTML |