Skip to content

Go package for querying and parsing domain information from WHOIS servers.

Notifications You must be signed in to change notification settings

melvinsh/multiwhois

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

multiwhois

multiwhois is a Go package for querying and parsing domain information from WHOIS servers.

It uses the github.com/domainr/whois package to fetch the WHOIS information and parses the response into a struct containing the domain owner, expiration date, and availability status.

Supported TLDs

It currently supports parsing WHOIS information for the following TLDs:

  • .com
  • .info
  • .be
  • .nl

Installation

To install the package, use the following command:

go get github.com/melvinsh/multiwhois

Usage

package main

import (
	"fmt"

	"github.com/melvinsh/multiwhois"
)

func main() {
	info, err := multiwhois.QueryDomainInfo("google.com")
	if err != nil {
		panic(err)
	}

	fmt.Println("Domain:", info.Domain)
        fmt.Println("Available:", info.IsAvailable)
	fmt.Println("Expiration:", info.Expiration)
	fmt.Println("Full WHOIS response:", info.FullWhois)
}

The QueryDomainInfo function takes a domain name as its argument and returns a *DomainInfo struct and an error. The *DomainInfo struct contains the following fields:

  • Domain (string): the domain name
  • Expiration (time.Time): the expiration date of the domain
  • IsAvailable (bool): whether the domain is available or not
  • FullWhois (string): the full WHOIS response

Testing

To run the tests, use the following command:

go test github.com/melvinsh/multiwhois

Configuration

multiwhois uses YAML files to configure the regex patterns for parsing WHOIS responses. The YAML files are located in the tlds directory and are named after the TLD they represent (e.g. com.yml for the .com TLD).

The YAML file can contain the following fields, depending on which information is returned by the WHOIS servers for each TLD:

  • availability (string): a regex pattern for determining the availability of the domain
  • expiration (string): a regex pattern for extracting the expiration date from the WHOIS response
  • expiration_format (string): the format used to parsed the expiration time

Here is an example YAML file for the .com TLD:

expiration: 'Registry Expiry Date: ([^\r\n]+)'
expiration_format: '2006-01-02T15:04:05Z'
availability: 'No match for'

About

Go package for querying and parsing domain information from WHOIS servers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages