geoip

根据 IP 查询 Geo 信息(国家/地区/城市/经纬度/时区/ASN 等)。支持 Cloudflare Radar IP API 与 MaxMind GeoIP。脚本输出 JSON,便于直接粘贴或进一步解析。

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "geoip" with this command: npx skills add robberphex/skills/robberphex-skills-geoip

GeoIP

用本 skill 处理“给我一个 IP,查它的地理位置/运营商/ASN”等需求。默认同时查询 Cloudflare 与 MaxMind,并输出综合结果。

输入约束

  • 只接受 IP 字符串(IPv4/IPv6)。
  • 如果用户给的是域名/URL:先让用户提供 IP(本 skill 不包含 DNS 解析脚本)。
  • 如果是内网/保留地址(如 10.0.0.0/8, 192.168.0.0/16, 127.0.0.1, ::1):直接说明这是非公网地址,GeoIP 通常无意义;除非用户明确要继续。

数据源与查询策略

  • Cloudflare:需要 CLOUDFLARE_API_TOKEN,走 api.cloudflare.com
  • MaxMind demo:无需 token,但依赖网页/CSRF/token 流程,可能随时变更、限流或返回非预期页面。

默认策略(重点):

  1. 只要 CLOUDFLARE_API_TOKEN 已设置,就同时查询 Cloudflare 和 MaxMind(可并发执行)。
  2. 若未设置 CLOUDFLARE_API_TOKEN,只查 MaxMind,并在结果中标注 Cloudflare 未执行。
  3. 若其中一个源失败,仍返回另一个源结果,并清楚标注失败源的错误信息。
  4. 综合结果按字段合并:优先 Cloudflare,缺失字段再回填 MaxMind(同时保留双源原始 JSON 便于核对)。

代理

两个脚本都支持读取 https_proxy 环境变量(例如 http://127.0.0.1:7890)。

运行脚本

从仓库根目录运行(确保能找到依赖的 node_modules/):

# Cloudflare
node skills/geoip/scripts/cloudflare-geoip.mjs <ip>

# MaxMind demo
node skills/geoip/scripts/maxmind-geoip.mjs <ip>

# 同时查询(推荐)
(
  node skills/geoip/scripts/cloudflare-geoip.mjs <ip> > /tmp/geoip-cloudflare.json &
  node skills/geoip/scripts/maxmind-geoip.mjs <ip> > /tmp/geoip-maxmind.json &
  wait
)

Cloudflare 需要:

export CLOUDFLARE_API_TOKEN="..."

输出与交付格式

各脚本会把上游响应 原样 JSON pretty-print 输出到 stdout。

对用户的最终回答按两层输出:

  1. 综合归一化摘要ip, country, region, city, latitude, longitude, timezone, postal, asn, org/isp
  2. 字段来源标注:为关键字段标注来源(Cloudflare / MaxMind / merged-fallback)。
  3. 双源状态cloudflare_status, maxmind_status(success / failed / skipped)。
  4. 双源原始 JSON:如果用户要“完整输出/调试”,附上两个脚本输出(或说明保存路径)。

综合字段优先级(默认):

  1. 定位与网络字段(国家/地区/城市/ASN/组织)优先 Cloudflare,缺失时回填 MaxMind。
  2. 经纬度/时区/邮编按“先 Cloudflare 后 MaxMind”回填。
  3. 若两源同字段冲突,摘要中用优先值,并在备注里写明冲突值(例如 city: "A" (MaxMind: "B"))。

如果用户给了多个 IP:

  • 每个 IP 都尽量双源查询并综合;最后给简短表格(IP -> 国家/城市/ASN/来源状态),需要时附每个 IP 的详细双源 JSON。

常见问题排查

  • Cloudflare 报错 please set env CLOUDFLARE_API_TOKEN:让用户设置 CLOUDFLARE_API_TOKEN,然后重试。
  • MaxMind demo 返回解析失败/非 JSON:优先判定为上游页面变更或风控;保留 Cloudflare 结果并标注 MaxMind 失败。
  • 网络不通:确认是否需要 https_proxy,以及代理是否支持 HTTPS CONNECT。

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Find Skills for ClawHub

Search for and discover OpenClaw skills from ClawHub (the official skill registry). Activate when user asks about finding skills, installing skills, or wants...

Registry SourceRecently Updated
2771Profile unavailable
General

Skill Listing Polisher

Improve a skill's public listing before publish. Use when tightening title, description, tags, changelog, and scan-friendly packaging so the listing looks cl...

Registry SourceRecently Updated
1130Profile unavailable
General

Skill Priority Setup

Scans installed skills, suggests L0-L3 priority tiers, and auto-configures skill injection policy. Use when: setting up skill priorities, optimizing token bu...

Registry SourceRecently Updated
2500Profile unavailable
General

Skill Quick Index

Build a wide-trigger, precise-match index for local OpenClaw skills (L1-L3), then quickly route by intent/category/keywords.

Registry SourceRecently Updated
2380Profile unavailable