KW

kincaidyang/whois

API development

This page was translated automatically. Technical details may differ from the original. View the original

66 stars 17 forks Quality 74 Trend 34MIT

Self-hosted WHOIS/RDAP API and MCP server for domains, IPv4/IPv6, CIDRs and ASNs.

Overview

The Golang-based domain name Whois query tool supports querying Whois information for all TLD suffix domains, IPv4/v6, and ASN that allow public queries. According to ICANN's "Temporary Specification for gTLD Registration Data" and the EU "General Data Protection Regulation" compliance requirements, when querying domain name information, the program only returns some necessary information (see the sample results below), and does not return the owner's contact information, address, phone, email, or other fields. This program uses memory cache by default and can be run directly; For production environments or multi-instance deployments, it is recommended to use it together with Redis. You can refer to https://redis.io/docs/install/install-redis/install-redis-on-linux/ for installation. ⚠️ Configuration items are grouped by function, with key names (matching the style of API response fields). Unknown keys or older (pre-v0.9) flat keys will cause errors and migration prompts at startup, and will not silently revert to default values. All configuration items can be overridden by environment variables (with higher priority than configuration files), suitable for deployment methods like Docker/Kubernetes where it is inconvenient to mount configuration files: Boolean variables only recognize true and 1; other values are considered false. Numeric variables ignore and retain configuration files/default values when parsing fails. - : Recommended to use Redis for better performance and multi-instance cache sharing - : Adjust based on query frequency, recommended 3600 seconds - : Backup when Redis is unavailable, once the limit is reached, use LRU (Least Recently Used) to eliminate - : Briefly cache "unfounded/rejected" query results to avoid repeated upstream requests to non-existent resources; Default 60 seconds - : Control the request frequency to upstream servers to avoid rate limiting. - : Some TLDs may require proxy access; specific extensions can be configured to use proxies - :d Ebug outputs each cache hit and upstream query, causing higher noise during heavy traffic; In production environments, it is recommended to keep info - : When the service starts, the latest RDAP server list is immediately pulled from IANA and refreshed periodically at this interval; Compiling binary data as a backup in case of pull failure - : Closed by default. Enabled after configuring auth.keys; requests without valid keys return 401 (RFC 9457 problem+json); Only /health and /ready exemptions facilitate the operation of live/ready probes - : auth.keys object form can set display name and rate limits for each key.

Overview (machine translated)

English

Introduction

A Golang-based domain name Whois query tool supports querying Whois information for all domains with TLD extensions that allow public queries, IPv4/v6, and ASN. According to ICANN’s Temporary Specification for gTLD Registration Data and the EU GDPR compliance requirements, when querying domain name information, the program only returns some necessary information (see the sample results below), and does not return the owner’s fields such as 联系方式, 地址, 电话, or [T3]].

Demo site:

How to use

Docker Deployment

Download

Using binary files

You can download binaries for the corresponding platform from the Release page.

Compiled from source code

Installing dependencies

This program uses memory cache by default and can be run directly; For production environments or multi-instance deployments, it is recommended to use it together with Redis. You can refer to https://redis.io/docs/install/install-redis/install-redis-on-linux/ for installation.

Edit the configuration file

⚠️ > Configuration items are grouped by function, with the key named camelCase (matching the style of the API response field). Unknown keys or older (pre-v0.9) flat keys will cause errors and migration prompts at startup, and will no longer silently revert to default values.

Environment variables

All configuration items can be overridden by environment variables (with higher priority than configuration files), suitable for deployment methods like Docker/Kubernetes where it is inconvenient to mount configuration files:

Environment Variable Corresponding Configuration Item Default Value Description
WHOIS_PORT server.port 8043 Service listening port
WHOIS_RATE_LIMIT server.rateLimit 100 Maximum number of concurrent requests
WHOIS_UPSTREAM_LIMIT server.upstreamLimit Same rateLimit Maximum number of concurrent upstream queries
WHOIS_LOG_LEVEL log.level info Log levels: debug, info, warn, error
WHOIS_CACHE_EXPIRATION cache.expiration 3600 Cache expiration time (seconds)
WHOIS_NEGATIVE_CACHE_EXPIRATION `cache.

This page was translated automatically. Technical details may differ from the original.

Install

docker run -d --name redis -p 6379:6379 redis:latest
New to MCP? Start with the mcpskill.org guide →