{"id":35404912,"url":"https://github.com/lwpk110/free-geoip-databases","last_synced_at":"2026-06-12T13:00:56.486Z","repository":{"id":322595589,"uuid":"1090079712","full_name":"lwpk110/free-geoip-databases","owner":"lwpk110","description":"Free IP location database， Free MaxMind's GeoIP2 GeoLite2 Country, City, and ASN databases, DB-IP Country, City, and ASN databases","archived":false,"fork":false,"pushed_at":"2026-04-01T10:22:03.000Z","size":99,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-02T04:59:48.461Z","etag":null,"topics":["db-ip","dbip","geo","geolite2","geolocation","iplocation","maxmind","maxmind-geoip"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lwpk110.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-05T07:38:29.000Z","updated_at":"2025-11-14T09:44:24.000Z","dependencies_parsed_at":"2026-03-01T12:13:04.485Z","dependency_job_id":null,"html_url":"https://github.com/lwpk110/free-geoip-databases","commit_stats":null,"previous_names":["lwpk110/free-geoip-databases"],"tags_count":54,"template":false,"template_full_name":null,"purl":"pkg:github/lwpk110/free-geoip-databases","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwpk110%2Ffree-geoip-databases","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwpk110%2Ffree-geoip-databases/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwpk110%2Ffree-geoip-databases/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwpk110%2Ffree-geoip-databases/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lwpk110","download_url":"https://codeload.github.com/lwpk110/free-geoip-databases/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwpk110%2Ffree-geoip-databases/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34245218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["db-ip","dbip","geo","geolite2","geolocation","iplocation","maxmind","maxmind-geoip"],"created_at":"2026-01-02T12:36:53.818Z","updated_at":"2026-06-12T13:00:56.437Z","avatar_url":"https://github.com/lwpk110.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Free GeoIP Databases - Auto-Updated 🌍\n\n\u003cdiv align=\"center\"\u003e\n\n**[ 中文 | [English](README_EN.md) ]**\n\n**📚 文档 Documentation: [中文](docs/cn/) | [English](docs/en/)**\n\n## 📦 Database Updates\n\n[![GeoLite2](https://github.com/lwpk110/free-geoip-databases/actions/workflows/update-geolite2.yml/badge.svg)](https://github.com/lwpk110/free-geoip-databases/actions/workflows/update-geolite2.yml)\n[![DB-IP](https://github.com/lwpk110/free-geoip-databases/actions/workflows/update-dbip.yml/badge.svg)](https://github.com/lwpk110/free-geoip-databases/actions/workflows/update-dbip.yml)\n\n## 🧪 Quality Checks\n\n[![GeoLite2 Tests](https://github.com/lwpk110/free-geoip-databases/actions/workflows/test-geolite.yml/badge.svg)](https://github.com/lwpk110/free-geoip-databases/actions/workflows/test-geolite.yml)\n[![DB-IP Tests](https://github.com/lwpk110/free-geoip-databases/actions/workflows/test-dbip.yml/badge.svg)](https://github.com/lwpk110/free-geoip-databases/actions/workflows/test-dbip.yml)\n\n---\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![GitHub Stars](https://img.shields.io/github/stars/lwpk110/free-geoip-databases?style=flat-square)](https://github.com/lwpk110/free-geoip-databases/stargazers)\n[![GitHub Forks](https://img.shields.io/github/forks/lwpk110/free-geoip-databases?style=flat-square)](https://github.com/lwpk110/free-geoip-databases/network/members)\n\n\u003c/div\u003e\n\n\u003e **免费、自动更新的 GeoIP 数据库集合** - 提供 MaxMind GeoLite2、DB-IP 等数据库的自动化下载和发布服务\n\n无需注册 MaxMind 账号，无需申请 License Key，直接从 [Releases](../../releases) 下载最新数据库！\n\n## 🎯 为什么选择这个项目？\n\n- ✅ **完全免费** - 无需注册，无需 License Key（DB-IP 版本）\n- 🤖 **自动更新** - GeoLite2 每周更新（周二、周五），DB-IP 每月更新（1号、15号）\n- 📦 **开箱即用** - 直接下载 `.mmdb` 文件即可使用\n- **多种数据库** - 提供 City、Country、ASN 等多种数据库\n- 🌐 **多种来源** - 同时提供 MaxMind GeoLite2 和 DB-IP 数据库\n- ✅ **质量保证** - 自动化测试确保数据库完整性\n- 🚀 **自托管 API** - 提供开箱即用的 GeoIP 查询 API 服务和 Web 界面\n\n## 🆕 新功能：自托管 GeoIP API 服务\n\n本项目现在提供了基于 Golang 实现的 GeoIP 查询 API 服务，支持：\n\n- 🌐 **RESTful API** - 标准的 HTTP API 接口\n- 🖥️ **Web 界面** - 用户友好的查询界面\n- 🔄 **多数据库支持** - 兼容 GeoLite2 和 DB-IP\n- 🚀 **轻量部署** - Docker 支持，一键启动\n- 📊 **实时监控** - 数据库状态和系统监控\n\n### 快速启动 API 服务\n\n```bash\n# 1. 克隆仓库\ngit clone https://github.com/lwpk110/free-geoip-databases.git\ncd free-geoip-databases\n\n# 2. 下载数据库（使用 DB-IP，无需注册）\n./scripts/download_dbip.sh all\n\n# 3. 启动服务\nmake run\n\n# 或使用 Docker\nmake docker-run\n```\n\n访问 http://localhost:8080 即可使用 Web 界面查询 IP 地址！\n\n详细文档请查看 [GeoIP API 文档](cmd/geoip-api/README.md)。\n\n## 📥 快速下载\n\n### MaxMind GeoLite2 数据库\n\n访问 [**Releases 页面**](../../releases/latest) 下载最新数据库文件：\n\n| 数据库 | 说明 | 文件大小 | 授权 | 获取方式 |\n|--------|------|---------|------|----------|\n| **GeoLite2-City** | 城市级别地理位置数据 | ~70 MB | GeoLite2 EULA | [Releases 页面](../../releases?q=geolite2) |\n| **GeoLite2-Country** | 国家级别地理位置数据 | ~6 MB | GeoLite2 EULA | [Releases 页面](../../releases?q=geolite2) |\n| **GeoLite2-ASN** | ASN 网络运营商数据 | ~8 MB | GeoLite2 EULA | [Releases 页面](../../releases?q=geolite2) |\n\n\u003e **注意**: GeoLite2 数据库文件名包含日期信息（如 `GeoLite2-City-20251105.mmdb`），请访问 Releases 页面选择最新版本下载。\n\n### DB-IP 数据库\n\n查看 [**DB-IP Releases**](../../releases?q=dbip\u0026expanded=true) 下载 DB-IP 数据库：\n\n| 数据库 | 说明 | 文件大小 | 授权 | 获取方式 |\n|--------|------|---------|------|----------|\n| **DB-IP City Lite** | 城市级别地理位置数据 | ~130 MB | CC BY 4.0 | [Releases 页面](../../releases?q=dbip) |\n| **DB-IP Country Lite** | 国家级别地理位置数据 | ~7 MB | CC BY 4.0 | [Releases 页面](../../releases?q=dbip) |\n| **DB-IP ASN Lite** | ASN 网络运营商数据 | ~9 MB | CC BY 4.0 | [Releases 页面](../../releases?q=dbip) |\n\n\u003e **注意**: DB-IP 数据库文件名包含年月信息（如 `dbip-city-lite-2025-11.mmdb`），请访问 Releases 页面选择最新版本下载。\n\n### 命令行下载\n\n由于文件名包含日期信息，建议通过以下方式获取最新数据库：\n\n**方法一：使用项目提供的下载脚本**\n\n```bash\n# MaxMind GeoLite2（需要 License Key）\n./scripts/download_geolite2.sh \u003cYOUR_LICENSE_KEY\u003e\n\n# DB-IP（无需 License Key）\n./scripts/download_dbip.sh all\n```\n\n**方法二：从 GitHub Releases 下载**\n\n```bash\n# 访问 Releases 页面选择最新版本\n# GeoLite2: https://github.com/lwpk110/free-geoip-databases/releases?q=geolite2\n# DB-IP: https://github.com/lwpk110/free-geoip-databases/releases?q=dbip\n\n# 或使用 GitHub CLI\ngh release list --repo lwpk110/free-geoip-databases\ngh release download \u003ctag-name\u003e --repo lwpk110/free-geoip-databases\n```\n\n## 🚀 使用示例\n\n### Go 语言\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"net\"\n\n    \"github.com/oschwald/geoip2-golang\"\n)\n\nfunc main() {\n    // 打开数据库\n    db, err := geoip2.Open(\"GeoLite2-City.mmdb\")\n    if err != nil {\n        log.Fatal(err)\n    }\n    defer db.Close()\n\n    // 查询 IP\n    ip := net.ParseIP(\"8.8.8.8\")\n    record, err := db.City(ip)\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    // 输出结果\n    fmt.Printf(\"国家: %s\\n\", record.Country.Names[\"zh-CN\"])\n    fmt.Printf(\"城市: %s\\n\", record.City.Names[\"zh-CN\"])\n    fmt.Printf(\"经纬度: %.4f, %.4f\\n\", record.Location.Latitude, record.Location.Longitude)\n}\n```\n\n### Python\n\n```python\nimport geoip2.database\n\n# 打开数据库\nwith geoip2.database.Reader('GeoLite2-City.mmdb') as reader:\n    # 查询 IP\n    response = reader.city('8.8.8.8')\n\n    # 输出结果\n    print(f\"国家: {response.country.names['zh-CN']}\")\n    print(f\"城市: {response.city.names.get('zh-CN', 'N/A')}\")\n    print(f\"经纬度: {response.location.latitude}, {response.location.longitude}\")\n```\n\n### Node.js\n\n```javascript\nconst maxmind = require('maxmind');\n\n// 打开数据库\nmaxmind.open('GeoLite2-City.mmdb').then(lookup =\u003e {\n    // 查询 IP\n    const result = lookup.get('8.8.8.8');\n\n    // 输出结果\n    console.log(`国家: ${result.country.names['zh-CN']}`);\n    console.log(`城市: ${result.city.names['zh-CN']}`);\n    console.log(`经纬度: ${result.location.latitude}, ${result.location.longitude}`);\n});\n```\n\n## 🔄 更新频率\n\n### MaxMind GeoLite2\n\n- **自动更新**: 每周二和周五（UTC 10:00 / 北京时间 18:00）\n- **数据源**: MaxMind 官方 GeoLite2 数据库\n- **更新策略**: 跟随 MaxMind 官方更新周期\n\n### DB-IP\n\n- **自动更新**: 每月1号和15号（UTC 10:00 / 北京时间 18:00）\n- **数据源**: DB-IP 官方免费数据库\n- **更新策略**: 下载当月最新版本\n- **授权**: Creative Commons Attribution 4.0 (CC BY 4.0)\n\n## 📊 数据库对比\n\n### MaxMind GeoLite2 vs DB-IP\n\n| 特性 | GeoLite2 | DB-IP Lite |\n|------|----------|-----------|\n| **授权** | 需遵守 MaxMind EULA | CC BY 4.0（更自由） |\n| **更新频率** | 每周2次 | 每月1次 |\n| **数据准确性** | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ |\n| **文件格式** | .mmdb | .mmdb（兼容） |\n| **使用限制** | 非商业用途优先 | 署名即可商用 |\n| **注册要求** | 需要（本项目已处理） | 无需注册 |\n\n### 支持的数据库类型\n\n| 数据库类型 | 包含信息 | 文件大小 |\n|-----------|---------|----------|\n| **City** | 国家、省份/州、城市、邮编、经纬度、时区 | ~70 MB |\n| **Country** | 国家、大洲 | ~6 MB |\n| **ASN** | 自治系统号、网络运营商 | ~8 MB |\n\n## 🛠️ 本地运行测试工具\n\n本项目提供了简单的 Go 语言查询工具，可以测试数据库文件。\n\n### 项目结构\n\n```text\nfree-geoip-databases/\n├── .github/workflows/    # GitHub Actions 自动化工作流\n│   ├── update-geolite2.yml\n│   ├── update-dbip.yml\n│   └── test-database.yml\n├── scripts/              # 下载脚本\n│   ├── download_geolite2.sh\n│   └── download_dbip.sh\n├── examples/             # 示例代码\n│   ├── query/            # IP 查询示例\n│   │   └── main.go\n│   └── test/             # 测试程序\n│       └── test_cities.go\n├── docs/                 # 详细文档\n│   ├── QUICKSTART.md\n│   └── TESTING.md\n├── README.md\n├── LICENSE\n├── go.mod\n└── go.sum\n```\n\n### 快速开始\n\n```bash\n# 1. 克隆仓库\ngit clone https://github.com/lwpk110/free-geoip-databases.git\ncd free-geoip-databases\n\n# 2. 下载数据库文件\n./scripts/download_geolite2.sh \u003cYOUR_LICENSE_KEY\u003e\n# 或使用 DB-IP (无需 License Key)\n./scripts/download_dbip.sh all\n\n# 3. 安装依赖\ngo mod tidy\n\n# 4. 运行查询示例\ncd examples/query\ngo run main.go\n\n# 5. 运行测试\ncd ../test\ngo run test_cities.go\n```\n\n更多详情请查看 [examples/README.md](examples/README.md) 和 [docs/cn/TESTING.md](docs/cn/TESTING.md)。\n\n## ⚙️ Fork 本项目实现自动更新\n\n### 配置 MaxMind GeoLite2 自动更新\n\n如果你想 Fork 本项目并实现自己的 GeoLite2 自动更新：\n\n1. **Fork 本仓库**\n\n2. **添加 MaxMind License Key**\n   - 访问 [MaxMind 注册](https://www.maxmind.com/en/geolite2/signup)\n   - 生成 License Key\n   - 在你的仓库中：Settings → Secrets and variables → Actions\n   - 添加 Secret: `MAXMIND_LICENSE_KEY`\n\n3. **添加 GitHub Token**\n   - 在你的仓库中：Settings → Secrets and variables → Actions\n   - 添加 Secret: `GEOIP_ACCESS_TOKEN`（使用有 repo 权限的 Personal Access Token）\n\n4. **启用 GitHub Actions**\n   - 工作流将自动运行\n   - 或手动触发：Actions → Update GeoLite2 Database → Run workflow\n\n### 配置 DB-IP 自动更新\n\nDB-IP 数据库无需任何配置，只需：\n\n1. **Fork 本仓库**\n\n2. **添加 GitHub Token**\n   - 在你的仓库中：Settings → Secrets and variables → Actions\n   - 添加 Secret: `GEOIP_ACCESS_TOKEN`\n\n3. **启用 GitHub Actions**\n   - DB-IP 工作流会自动运行\n   - 或手动触发：Actions → Update DB-IP Database → Run workflow\n\n\u003e **提示**: DB-IP 不需要注册账号或 License Key，完全免费且开放！\n\n## 📋 许可与声明\n\n- **项目代码**: MIT License\n- **GeoLite2 数据库**: 由 MaxMind 提供，需遵守 [MaxMind EULA](https://www.maxmind.com/en/geolite2/eula)\n  - This product includes GeoLite2 data created by MaxMind, available from [https://www.maxmind.com](https://www.maxmind.com)\n- **DB-IP 数据库**: 由 DB-IP 提供，使用 [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/) 授权\n  - 使用时需要署名：Contains data from https://db-ip.com\n\n### 重要提示\n\n- GeoLite2 和 DB-IP Lite 都是免费版本，精确度低于商业版\n- GeoLite2: 仅供学习、测试和非商业用途，商业用途请购买 MaxMind 商业授权\n- DB-IP: 可商用，但需要署名（Attribution required）\n- 如需更高精确度或商业支持，请考虑购买商业版数据库\n\n## 🌟 Star History\n\n如果这个项目对你有帮助，请给一个 ⭐ Star！这将激励我持续维护和更新。\n\n## 🤝 贡献\n\n欢迎提交 Issue 和 Pull Request！\n\n## � 支持\n\n- 🐛 [报告 Bug](../../issues)\n- 💡 [功能建议](../../issues)\n- ⭐ [Star 本项目](../../stargazers)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwpk110%2Ffree-geoip-databases","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flwpk110%2Ffree-geoip-databases","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwpk110%2Ffree-geoip-databases/lists"}