A minimal, RFC-faithful RDAP client for Go (RFC 9082/9083) with a tiny CLI (rdapctl).
No WHOIS fallback. Optional helpers in the library for DNS provider inference and DNSSEC fields.
- RDAP lookups for domain, nameserver, IP network, autnum (ASN), and entity
- Smart
lookupthat auto-detects the query type treemode to flush the reachable RDAP graph (nodes + edges), with cycle detection- Output:
--json(default for single-object cmds) outputs typed JSON- text mode (
--json=false) for human-friendly summaries
- Simple Makefile to:
- Bootstrap a pinned Go toolchain locally (no system-wide install needed)
- Build, test, lint (optional), and install the CLI
# 1) Clone
git clone https://github.com/datum-labs/rdap.git
cd rdap
# 2) Bootstrap a pinned Go toolchain locally (macOS/Linux; no sudo)
make bootstrap
# 3) Build the CLI (outputs ./bin/rdapctl)
make build
# 4) Try it out (uses the local toolchain automatically via Makefile recipes)
./bin/rdapctl domain example.com
./bin/rdapctl tree example.com --max-depth=5 --follow-links
# (Optional) Install to /usr/local/bin (set PREFIX to change)
sudo make install
# Update dependencies / tidy
make deps
# Run tests
make testCommon commands:
- Fetch a domain:
rdapctl domain example.com
- Auto-detect and fetch:
rdapctl lookup ns1.google.com
- Explore the full graph:
rdapctl tree example.com --max-depth=5 --follow-links
- Switch to text output:
rdapctl domain example.com --json=false
Flags you’ll use often:
--json(default true): emit JSON for single-object commands;treeemits a graph{nodes, edges}in JSON.--walk: in text mode, do a shallow, one-level expansion of related items.--follow-links: (fortree) traverse RDAPlinks[]where possible.--max-depth: (fortree) bound recursion (default 5).--tld: hint for entity/lookup resolution (e.g.--tld com).
RDAPCTL_UA– override User-Agent (e.g.,datum-rdapctl/1.0)RDAPCTL_TIMEOUT– HTTP timeout (e.g.,10s,20s)RDAPCTL_DNS_BOOTSTRAP– override IANA DNS bootstrap URLRDAPCTL_IP_BOOTSTRAP– override IANA IP bootstrap URLRDAPCTL_ASN_BOOTSTRAP– override IANA ASN bootstrap URL
You have two choices:
-
Use the local toolchain via Makefile (recommended).
This downloads a pinned Go toolchain under.toolchain/goand builds to./bin/rdapctl. See Quick start commands in <block 1>. -
Use your system Go:
- Go ≥ 1.24:
go build -o bin/rdapctl ./cmd/rdapctl
- Go ≥ 1.24:
From your Go code:
package main
import (
"context"
"fmt"
"github.com/datum-labs/rdap"
)
func main() {
c := rdap.New(
rdap.WithUserAgent("myapp/1.0 (+https://example.com)"),
)
ctx := context.Background()
d, err := c.Domain(ctx, "example.com")
if err != nil {
panic(err)
}
fmt.Println("Domain handle:", d.Handle)
ns, err := c.Nameserver(ctx, "ns1.google.com")
if err != nil {
panic(err)
}
fmt.Println("Nameserver:", ns.LDHName)
}make bootstrap(once), thenmake build,make test- Please run
go fmtand add/adjust tests for changes.
AGPL-3.0-only (see LICENSE).