Documentation
¶
Overview ¶
Package whois provides functionality for querying WHOIS information for domain names.
The package implements a WHOIS client that supports multiple TLD (Top Level Domain) adapters and can automatically detect the appropriate WHOIS server based on the domain name.
The client supports loading TLD configuration data from JSON files and provides flexible adapter options for different WHOIS server implementations.
Example usage:
client, err := whois.New()
if err != nil {
log.Fatal(err)
}
result, err := client.Whois(context.Background(), "example.com")
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrCannotMatchTLD = errors.New("cannot match TLD")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Whois returns the result of a whois query for the given host.
// The servers parameter is a list of whois servers to try in order, or nil to use the default list.
// The result is the raw whois output.
Whois(ctx context.Context, host string, servers ...string) (result string, err error)
io.Closer
}
Client is a whois client.
type Record ¶
type Record struct {
// Domain name.
Domain string `json:"domain"`
// Domain creation date.
CreatedDate time.Time `json:"created_date"`
}
Record is a whois record.
func ParseRecord ¶
ParseRecord parses raw WHOIS data for a given domain and returns a Record structure. It processes the raw byte data to extract domain information such as creation date.
Parameters:
- domain: The domain name for which the WHOIS data is being parsed
- data: Raw WHOIS response data as bytes
Returns:
- *Record: A pointer to a Record structure containing the parsed information
- error: An error if parsing fails, nil otherwise.