Versions in this module Expand all Collapse all v1 v1.0.0 Aug 5, 2026 Changes in this version + const DefaultConcurrency + const DefaultHTTPTimeout + const DefaultMaxResponseSize + const DefaultTimeout + const DefaultUserAgent + var ErrEmptyResponse = errors.New("whois: empty response from whois server") + var ErrInvalidDomain = errors.New("whois: invalid domain name") + var ErrNoWhoisServer = errors.New("whois: no whois server known for tld") + var ErrResponseTooLarge = errors.New("whois: response larger than the configured limit") + var ErrServerUnavailable = errors.New("whois: whois server is temporarily unavailable or rate-limited") + var ErrTLDNotSupported = errors.New("whois: tld is not supported by the whois server") + func CanLookup(tld string) bool + func Check(ctx context.Context, domains ...string) map[string]Status + func DetectAvailability(response, tld string, registryMarkerMatched bool) (bool, error) + func SplitDomain(domain string) (sld, tld string) + type CheckResult struct + Domain string + Err error + Result *Result + Status Status + func CheckAll(ctx context.Context, domains ...string) []CheckResult + type Client struct + func DefaultClient() (*Client, error) + func NewClient(opts ...Option) (*Client, error) + func (c *Client) CanLookup(tld string) bool + func (c *Client) Check(ctx context.Context, domains ...string) map[string]Status + func (c *Client) CheckAll(ctx context.Context, domains ...string) []CheckResult + func (c *Client) Lookup(ctx context.Context, domain string) (*Result, error) + func (c *Client) LookupDomain(ctx context.Context, domain Domain) (*Result, error) + func (c *Client) PopularTLDs() []string + func (c *Client) Registry() Registry + type Definition struct + Available string + Comment string + Extensions string + Premium string + URI string + func (d Definition) Address() string + func (d Definition) IsSocket() bool + type Definitions map[string]Definition + func BundledDefinitions() (Definitions, error) + func ParseDefinitions(data []byte) (Definitions, error) + func (d Definitions) CanLookup(tld string) bool + func (d Definitions) Clone() Definitions + func (d Definitions) Definition(tld string) (Definition, bool) + func (d Definitions) Merge(other Definitions) + func (d Definitions) TLDs() []string + type Details struct + Available bool + ContainsAvailabilityKeywords bool + ContainsNoMatchPatterns bool + ContainsRegistrationIndicators bool + ContainsUnavailabilityIndicators bool + ContainsUnsupportedTLDMessages bool + DomainStatusIndicators bool + Outcome Outcome + RegistryMarkerMatched bool + ResponseLength int + ResponsePreview string + ResponseTooShort bool + TLDSpecificPatterns bool + func AvailabilityDetails(response, tld string, registryMarkerMatched bool) Details + type Detector interface + Detect func(response, tld string, registryMarkerMatched bool) (bool, error) + type Domain struct + func ParseDomain(input string) (Domain, error) + func (d Domain) IsZero() bool + func (d Domain) SLD() string + func (d Domain) String() string + func (d Domain) TLD() string + func (d Domain) WithTLD(tld string) (Domain, error) + type HTTPTransport struct + Client *http.Client + MaxResponseSize int64 + UserAgent string + func (t *HTTPTransport) Query(ctx context.Context, domain string, def Definition) (*Response, error) + type Option func(*clientConfig) error + func WithConcurrency(n int) Option + func WithDefinitionOverrides(data []byte) Option + func WithDefinitions(defs Definitions) Option + func WithDetector(detector Detector) Option + func WithDialer(dialer *net.Dialer) Option + func WithHTTPClient(client *http.Client) Option + func WithHTTPTimeout(timeout time.Duration) Option + func WithInsecureTLS(insecure bool) Option + func WithMaxResponseSize(n int64) Option + func WithPopularTLDs(tlds ...string) Option + func WithRegistry(registry Registry) Option + func WithTimeout(timeout time.Duration) Option + func WithTransport(transport Transport) Option + func WithUserAgent(userAgent string) Option + type Outcome string + const OutcomeAvailable + const OutcomeEmptyResponse + const OutcomeServerUnavailable + const OutcomeUnavailable + const OutcomeUnsupportedTLD + func (o Outcome) String() string + type PatternDetector struct + func DefaultDetector() *PatternDetector + func NewPatternDetector() *PatternDetector + func (d *PatternDetector) Details(response, tld string, registryMarkerMatched bool) Details + func (d *PatternDetector) Detect(response, tld string, registryMarkerMatched bool) (bool, error) + func (d *PatternDetector) Rules() Rules + func (d *PatternDetector) WithRules(rules Rules) *PatternDetector + type Patterns []*regexp.Regexp + func CompileRules(patterns ...string) Patterns + func (p Patterns) Match(s string) bool + type Phrases []string + type Registry interface + Definition func(tld string) (Definition, bool) + type Response struct + Body string + Server string + StatusCode int + type Result struct + Definition Definition + Domain Domain + Raw string + Server string + Status Status + func Lookup(ctx context.Context, domain string) (*Result, error) + func (r *Result) AvailabilityDetails() Details + func (r *Result) IsAvailable() bool + func (r *Result) IsPremium() bool + func (r *Result) Message() string + type Router struct + HTTP Transport + Socket Transport + func (r Router) Query(ctx context.Context, domain string, def Definition) (*Response, error) + type Rules struct + AvailabilityKeywords Phrases + AvailabilityStatusIndicators Phrases + ErrorOrRestrictionMarkers Phrases + ExplicitVerdictPhrases Phrases + MinRecordLength int + MinRecordLines int + MinRegistrationFields int + MinRegistrationIndicators int + NoMatchPatterns Patterns + RegistrationFields Phrases + RegistrationIndicators Phrases + TLDAvailability TLDPatterns + TLDUnavailability TLDPatterns + TemporaryFailurePhrases Phrases + UnavailabilityPatterns Patterns + UnsupportedTLDPatterns Patterns + UnsupportedTLDPhrases Phrases + func DefaultRules() Rules + func (r Rules) Clone() Rules + func (r Rules) TLDs() []string + type SocketTransport struct + Dialer *net.Dialer + MaxResponseSize int64 + Timeout time.Duration + func (t *SocketTransport) Query(ctx context.Context, domain string, def Definition) (*Response, error) + type Status string + const StatusAvailable + const StatusError + const StatusInvalid + const StatusPremium + const StatusUnavailable + func (s Status) String() string + type TLDPatterns map[string]Patterns + func (t TLDPatterns) Lookup(tld string) Patterns + type Transport interface + Query func(ctx context.Context, domain string, def Definition) (*Response, error)