rdap

package
v0.62.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package rdap reads the registration date of a domain from the RDAP server of its registry (RFC 9082, RFC 9083), found through the IANA bootstrap file (RFC 9224), never through a third-party aggregator (docs/sources.md).

Only the registrable domain is sent, and only the domain object's own registration and last changed events are read: entities, and so the contacts they hold, are never decoded. Answers are cached for a day, "not found" and "no server" for a few minutes, and a registry that sends a Retry-After is left alone for that long.

Index

Constants

View Source
const BootstrapURL = "https://data.iana.org/rdap/dns.json"

BootstrapURL is the IANA bootstrap file for domain names (RFC 9224).

View Source
const Source = signal.RDAPSource

Source names the registry in reports.

Variables

View Source
var (
	// ErrBootstrap means the IANA bootstrap file could not be read.
	ErrBootstrap = errors.New("unusable RDAP bootstrap file")

	// ErrNoServer means the bootstrap file names no HTTPS RDAP server for
	// the domain's extension.
	ErrNoServer = fmt.Errorf("no RDAP server for this extension: %w", app.ErrNotCovered)

	// ErrNotFound means the registry answered that it holds no such domain.
	ErrNotFound = fmt.Errorf("domain not found in RDAP: %w", app.ErrNotFound)

	// ErrThrottled means the registry asked to wait (Retry-After) and the
	// wait is not over. No request was sent.
	ErrThrottled = errors.New("RDAP server asked to wait")

	// ErrResponse means the registry's answer is not an RDAP domain object.
	ErrResponse = errors.New("invalid RDAP domain response")
)

Functions

func BootstrapHosts

func BootstrapHosts() []string

BootstrapHosts returns the hosts the bootstrap client reaches, for its allowlist.

func Info added in v0.37.0

func Info() domain.SourceInfo

Info describes RDAP for GET /v1/sources: the registry of each extension, found through the IANA bootstrap, whose page lists them. Only the registration events of a domain are read (docs/sources.md).

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client reads the registration dates of domains from the RDAP server of their registry. It is safe for concurrent use.

func New

func New(iana Getter, bootstrapURL string, dial func(hosts []string) (Getter, error)) (*Client, error)

New returns a Client that reads the bootstrap file at bootstrapURL with iana, and queries registries with the client dial builds for the hosts the file names: the allowlist follows the file, and a user input only ever selects one of its servers.

func (*Client) Lookup

func (c *Client) Lookup(ctx context.Context, d domain.Domain) (domain.Registration, error)

Lookup returns the registration dates of d's registrable domain, from the cache or its registry. It returns ErrNoServer, ErrNotFound, ErrThrottled, ErrBootstrap, ErrResponse or the error of the HTTP client.

func (*Client) Source added in v0.23.0

func (*Client) Source() domain.Source

Source returns Source.

type Getter

type Getter interface {
	Get(ctx context.Context, rawURL string) ([]byte, error)
}

Getter fetches a URL; *httpclient.Client is one.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL