{"id":41190453,"url":"https://github.com/kincaidyang/whois","last_synced_at":"2026-04-02T18:55:37.827Z","repository":{"id":195916790,"uuid":"693951742","full_name":"KincaidYang/whois","owner":"KincaidYang","description":"Domain Whois query tool, supports domain, IPv4/v6, ASN Whois information query for all TLD suffixes that allow public queries.","archived":false,"fork":false,"pushed_at":"2025-12-08T03:20:49.000Z","size":268,"stargazers_count":51,"open_issues_count":0,"forks_count":12,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-23T11:47:49.019Z","etag":null,"topics":["api","domain","golang","ip","whois","whois-lookup"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KincaidYang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2023-09-20T03:18:52.000Z","updated_at":"2026-01-12T11:10:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"8df8d000-258b-4183-b0fd-a077e00d96d6","html_url":"https://github.com/KincaidYang/whois","commit_stats":null,"previous_names":["kincaidyang/whois"],"tags_count":41,"template":false,"template_full_name":null,"purl":"pkg:github/KincaidYang/whois","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KincaidYang%2Fwhois","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KincaidYang%2Fwhois/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KincaidYang%2Fwhois/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KincaidYang%2Fwhois/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KincaidYang","download_url":"https://codeload.github.com/KincaidYang/whois/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KincaidYang%2Fwhois/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28928698,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T02:59:34.861Z","status":"ssl_error","status_checked_at":"2026-01-31T02:59:05.369Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api","domain","golang","ip","whois","whois-lookup"],"created_at":"2026-01-22T20:22:56.751Z","updated_at":"2026-02-14T11:18:35.298Z","avatar_url":"https://github.com/KincaidYang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Reference](https://pkg.go.dev/badge/github.com/KincaidYang/whois.svg)](https://pkg.go.dev/github.com/KincaidYang/whois) [![Go](https://github.com/KincaidYang/whois/actions/workflows/go.yml/badge.svg)](https://github.com/KincaidYang/whois/actions/workflows/go.yml) [![CodeQL](https://github.com/KincaidYang/whois/actions/workflows/codeql.yml/badge.svg)](https://github.com/KincaidYang/whois/actions/workflows/codeql.yml)\n\n[English](README_EN.md)\n\n## 介绍\n基于 Golang 实现的域名 Whois 查询工具，支持所有允许公开查询的 TLD 后缀的域名、IPv4/v6、ASN 的 Whois 信息查询。\n根据 ICANN 《通用顶级域名注册数据临时政策细则（Temporary Specification for gTLD Registration Data）》和欧盟《通用数据保护条例》合规要求，在查询域名信息时，程序只返回了部分必要的信息（详见下方返回结果示例），不会返回所有者的`联系方式`、`地址`、`电话`、`邮箱`等字段。\n\n演示站点：\n- [https://whois.ddnsip.cn](https://whois.ddnsip.cn)\n- [https://whois.mmoke.com](https://whois.mmoke.com/) By [immoke](https://github.com/immoke)\n\n## 使用方法\n### Docker部署\n```bash\n# 安装 Redis\ndocker run -d --name redis -p 6379:6379 redis:latest\n# 运行 whois\ndocker run -d --name whois -p 8043:8043 --link redis:redis jinzeyang/whois\n# 运行 whois（大陆推荐）\ndocker run -d --name whois -p 8043:8043 --link redis:redis docker.cnb.cool/kincaidyang/whois\n```\n\n### 下载\n#### 使用二进制文件\n您可从 [Release](https://github.com/KincaidYang/whois/releases) 页面下载对应平台的二进制文件。\n#### 从源码编译\n```bash\ngit clone https://github.com/KincaidYang/whois.git\ncd whois\ngo build\n```\n### 安装依赖\n本程序需要 Redis 服务支持，您可参照 https://redis.io/docs/install/install-redis/install-redis-on-linux/ 进行安装。\n\n### 编辑配置文件\n```bash\nvim config.yaml\n```\n```yaml\nredis:\n  addr: \"redis:6379\"          # Redis服务器地址\n  password: \"\"                 # Redis密码，如无密码则留空\n  db: 0                        # Redis数据库编号\ncacheExpiration: 3600          # 缓存过期时间，单位：秒\n\n# 高级缓存配置（可选，新版本功能）\ncache:\n  requireRedis: false          # false=允许Redis失败时降级到内存缓存，true=Redis必须可用否则程序退出\n  memoryMaxSize: 10000         # 内存缓存最大条目数，超过此数量将不再缓存新数据（默认: 10000）\n  memoryCleanInterval: 300     # 内存缓存过期数据清理间隔，单位：秒（默认: 300）\n\nport: 8043                     # 服务监听端口\nrateLimit: 50                  # 并发限制，即程序向上游whois服务器发起的最大并发请求数\n\n# 代理配置（可选）\nProxyServer: \"http://127.0.0.1:8080\"  # 代理服务器地址\nProxySuffixes:                         # 需要使用代理的TLD后缀列表，留空表示不使用代理\nProxyUsername: \"\"                      # 代理服务器用户名（如需认证）\nProxyPassword: \"\"                      # 代理服务器密码（如需认证）\n```\n\n**配置说明：**\n- **Redis配置**：建议使用Redis以获得更好的性能和多实例缓存共享能力\n- **缓存过期时间**：根据查询频率调整，建议3600秒\n- **并发限制**：控制向上游服务器的请求频率，避免被限流。\n- **代理配置**：某些TLD可能需要代理访问，可配置特定后缀使用代理\n\n\n\u003e ⚠️ **Warning:** 限频针对的是程序向 whois 服务器发起的请求，而非用户向本程序发起的请求。例如，您将限频设置为 50，那么程序向注册局 whois 服务器发起的请求将不会超过 50 次/秒，但是用户向本程序发起的请求不受限制。请您通过 Nginx 等工具对本程序进行限流，以防止恶意请求。\n\n### 运行\n```bash\n./whois\n```\n**注意：** 本程序默认监听 8043 端口。\n\n### 健康检查端点\n\n服务提供以下健康检查端点：\n\n| 端点 | 描述 |\n|------|------|\n| `GET /health` | 存活检查 - 服务运行即返回 200 |\n| `GET /ready` | 就绪检查 - 检查缓存和并发容量状态 |\n| `GET /info` | 运行时信息 - 版本、运行时间、Go 版本等 |\n\n**示例：**\n```bash\ncurl http://localhost:8043/health\n```\n```json\n{\n  \"status\": \"ok\",\n  \"timestamp\": \"2026-02-05T01:32:05Z\",\n  \"uptime\": \"10s\",\n  \"checks\": {\n    \"cache\": {\"status\": \"ok\", \"message\": \"redis\"}\n  }\n}\n```\n\n### 进程守护（可选）\n您可以使用 systemd 等工具将本程序设置为守护进程，以便在系统重启后自动运行。\n```bash\nvim /etc/systemd/system/whois.service\n```\n```ini\n[Unit]\nDescription=whois\nAfter=network.target\n\n[Service]\nType=simple\nUser=www-data\nGroup=www-data\nExecStart=/path/to/whois/whois\nWorkingDirectory=/path/to/whois\nRestart=on-failure\n\n[Install]\nWantedBy=multi-user.target\n```\n### 使用\nGET 请求\n\n#### 浏览器访问\n部署后直接通过浏览器访问`http://ip:端口/你想查的域名或ip或asn`，默认端口`8043`，示例`http://1.2.3.4:8043/examlpe.com`,详细示例请参考下方\n\n#### 查询域名 Whois 信息\n```bash\ncurl http://localhost:8043/example.com\n```\n返回结果\n```json\n{\n    \"Domain Name\": \"EXAMPLE.COM\",\n    \"Registrar\": \"RESERVED-Internet Assigned Numbers Authority\",\n    \"Registrar IANA ID\": \"376\",\n    \"Domain Status\": [\n        \"client delete prohibited\",\n        \"client transfer prohibited\",\n        \"client update prohibited\"\n    ],\n    \"Creation Date\": \"1995-08-14T04:00:00Z\",\n    \"Registry Expiry Date\": \"2024-08-13T04:00:00Z\",\n    \"Updated Date\": \"2023-08-14T07:01:38Z\",\n    \"Name Server\": [\n        \"A.IANA-SERVERS.NET\",\n        \"B.IANA-SERVERS.NET\"\n    ],\n    \"DNSSEC\": \"signedDelegation\",\n    \"DNSSEC DS Data\": \"370 13 2 BE74359954660069D5C63D200C39F5603827D7DD02B56F120EE9F3A86764247C\",\n    \"Last Update of Database\": \"2024-01-16T10:26:40Z\"\n}\n```\n\n#### 查询 IPv4 Whois 信息\n```bash\ncurl http://localhost:8043/1.12.34.56\n```\n返回结果\n```json\n{\n  \"IP Network\": \"1.12.0.0 - 1.15.255.255\",\n  \"Address Range\": \"1.12.0.0 - 1.15.255.255\",\n  \"Network Name\": \"TencentCloud\",\n  \"CIDR\": \"1.12.0.0/14\",\n  \"Network Type\": \"ALLOCATED PORTABLE\",\n  \"Country\": \"CN\",\n  \"Status\": [\n    \"active\"\n  ],\n  \"Creation Date\": \"2010-05-10T22:46:58Z\",\n  \"Updated Date\": \"2023-11-28T00:51:33Z\",\n  \"Remarks\": [\n    {\n      \"title\": \"description\",\n      \"description\": [\n        \"Tencent cloud computing (Beijing) Co., Ltd.\",\n        \"Floor 6, Yinke Building,38 Haidian St,\",\n        \"Haidian District Beijing\"\n      ]\n    }\n  ]\n}\n```\n\n#### 查询 IPv6 Whois 信息\n```bash\ncurl http://localhost:8043/2402:4e00::\n```\n返回结果\n```json\n{\n  \"IP Network\": \"2402:4e00::/32\",\n  \"Address Range\": \"2402:4e00:: - 2402:4e00:ffff:ffff:ffff:ffff:ffff:ffff\",\n  \"Network Name\": \"TencentCloud\",\n  \"CIDR\": \"2402:4e00::/32\",\n  \"Network Type\": \"ALLOCATED PORTABLE\",\n  \"Country\": \"CN\",\n  \"Status\": [\n    \"active\"\n  ],\n  \"Creation Date\": \"2010-05-12T23:13:32Z\",\n  \"Updated Date\": \"2024-01-31T06:27:10Z\",\n  \"Remarks\": [\n    {\n      \"title\": \"description\",\n      \"description\": [\n        \"Tencent cloud computing (Beijing) Co., Ltd.\",\n        \"Floor 6, Yinke Building,38 Haidian St,Haidian District Beijing\"\n      ]\n    }\n  ]\n}\n```\n\n#### 查询 ASN Whois 信息\n```bash\ncurl http://localhost:8043/ASN205794\ncurl http://localhost:8043/AS205794\ncurl http://localhost:8043/205794\n```\n⚠ 不区分大小写\n\n返回结果\n```json\n{\n  \"AS Number\": \"AS205794\",\n  \"Network Name\": \"RTTW-AS\",\n  \"Status\": [\n    \"active\"\n  ],\n  \"Creation Date\": \"2022-04-14T12:24:55Z\",\n  \"Updated Date\": \"2024-03-21T07:27:44Z\",\n  \"remarks\": [\n    {\n      \"title\": \"\",\n      \"description\": [\n        \"https://as205794.net/\",\n        \"Geofeed https://geo.as205794.net/geofeed.csv\",\n        \"Looking Glass https://lg.as205794.net/\"\n      ]\n    }\n  ]\n}\n```\n\n## 已知问题\n程序向注册局查询 Whois 信息主要依靠 RDAP 协议查询，但由于大部分 ccTLD 不支持 RDAP 协议，程序会对其原始的 Whois 信息格式化后返回 JSON 数据，但由于本人精力有限，未对所有的 ccTLD 后缀进行适配，程序可能会直接返回 `text` 数据，如您常用的后缀没用被覆盖，可以提交 Issue 或者贡献匹配规则至 `whois_parsers.go` 文件中，在此表示感谢！\n\n您可根据`content-type`来判断返回数据格式。\n\n## 项目依赖\n\n本项目使用了以下Go标准库：\n\n- [`bytes`](https://golang.org/pkg/bytes/)：操作字节切片的函数。\n- [`context`](https://golang.org/pkg/context/)：定义了Context类型，用于在API边界和进程之间传递截止日期、取消信号和其他请求范围的值。\n- [`encoding/json`](https://golang.org/pkg/encoding/json/)：编码和解码JSON对象的函数。\n- [`errors`](https://golang.org/pkg/errors/)：创建错误和操作错误的函数。\n- [`fmt`](https://golang.org/pkg/fmt/)：格式化I/O函数。\n- [`io`](https://golang.org/pkg/io/)：I/O原语函数。\n- [`log`](https://golang.org/pkg/log/)：简单的日志服务。\n- [`net`](https://golang.org/pkg/net/)：网络I/O原语的函数。\n- [`net/http`](https://golang.org/pkg/net/http/)：HTTP客户端和服务器实现。\n- [`os`](https://golang.org/pkg/os/)：操作系统功能的函数。\n- [`os/signal`](https://golang.org/pkg/os/signal/)：接收操作系统信号的函数。\n- [`regexp`](https://golang.org/pkg/regexp/)：正则表达式搜索。\n- [`strconv`](https://golang.org/pkg/strconv/)：将字符串转换为基本类型的函数。\n- [`strings`](https://golang.org/pkg/strings/)：操作字符串的函数。\n- [`sync`](https://golang.org/pkg/sync/)：基本的同步原语。\n- [`syscall`](https://golang.org/pkg/syscall/)：访问操作系统底层调用的函数。\n- [`time`](https://golang.org/pkg/time/)：测量和显示时间的函数。\n\n本项目还使用了以下第三方库：\n\n- [`github.com/redis/go-redis/v9`](https://github.com/go-redis/redis)：Go语言Redis客户端。\n- [`golang.org/x/net/idna`](https://pkg.go.dev/golang.org/x/net/idna)：实现了IDNA（国际化域名在应用程序）规范。\n- [`golang.org/x/net/publicsuffix`](https://pkg.go.dev/golang.org/x/net/publicsuffix)：实现了公共后缀列表规范。\n- [`gopkg.in/yaml.v2`](https://gopkg.in/yaml.v2)：YAML 解析库。\n\nWHOIS/RDAP 服务器列表来自于：\n- [IANA](https://www.iana.org/domains/root/db)\n- [IANA RDAP Bootstrap](https://data.iana.org/rdap/)\n- [IANA RDAP Bootstrap (IPv4)](https://data.iana.org/rdap/ipv4.json)\n- [IANA RDAP Bootstrap (IPv6)](https://data.iana.org/rdap/ipv6.json)\n- [IANA RDAP Bootstrap (AS)](https://data.iana.org/rdap/asn.json)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkincaidyang%2Fwhois","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkincaidyang%2Fwhois","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkincaidyang%2Fwhois/lists"}