GET /api/query
GET /api/query?ip={target_ip}
ip
(可选): 要查询的 IP 地址(如 8.8.8.8
)若不传递参数,则默认返回请求客户端的IP信息。
{ "ip": "1.1.1.1", "asn": "AS13335", "as_name": "Cloudflare, Inc.", "network_type": "Content", "actual_country": "Australia", "actual_country_code": "AU", "reg_country": "Australia", "reg_country_code": "AU", "subdivisions": "Queensland", "city": "Brisbane", "time_zone": "", "ip_type": "Native", "meta": { "query_cost": "0.51ms", "city_provider": "ip2location" } }
ip
: 查询(或请求客户端)的 IP 地址,字符串类型,如 "1.1.1.1"
asn
: ASN 编号,字符串类型,如 "AS13335"
as_name
: ASN 名称,字符串类型,如 "Cloudflare, Inc."
network_type
: ASN 网络类型,字符串类型,表示该 ASN 的网络属性,如 ISP、Content 等actual_country
: IP 实际使用国家,字符串类型,如 "Australia"
actual_country_code
: IP 实际使用国家的 ISO 2 位代码,如 "AU"
reg_country
: IP 注册地国家,字符串类型,通常是 IP 所属组织注册的国家reg_country_code
: 注册地国家的 ISO 2 位代码subdivisions
: 省/州/等一级行政区名称,字符串类型,如 "Queensland"
city
: 城市名称,字符串类型,如 "Brisbane"
time_zone
: 时区信息,字符串类型,如 "Australia/Brisbane"
,如果无则为空字符串ip_type
: IP 类型,字符串类型,如 "Native"
、"Anycast"
等meta
: 元数据,包含查询相关的额外信息,是一个对象(JSON):
query_cost
: 查询耗时,字符串类型,单位为毫秒,如 "0.51ms"
city_provider
: 城市信息数据来源,如 "ip2location"
为保障服务质量,单个客户端 IP 地址的请求速率限制为 每秒最多 10 个请求(rate=10r/s
)。
超过速率的请求将被延迟或拒绝,请合理控制请求频率。
200
: 成功400
: 请求参数错误500
: 内部服务错误🧩 Powered by Gin & Go