whoisparser

package module
v1.15.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

WhoisParser

License GoDoc Build Status Go Report Card Code Cover

WhoisParser is s simple Go module for domain whois information parsing.

Overview

This module parses the provided whois information and returns a readable data struct.

Verified Extensions

It is supposed to be working with all domain extensions, but verified extensions must works, because I have checked them one by one manually.

If there is any problems, please feel free to open a new issue.

Binary distributions

For binary distributions of whois information query and parsing, please download whois release tool.

Installation

go get github.com/likexian/whois-parser-go

Importing

import (
    "github.com/likexian/whois-parser-go"
)

Documentation

Visit the docs on GoDoc

Example

result, err := whoisparser.Parse(whois_raw)
if err == nil {
    // Print the domain status
    fmt.Println(result.Domain.Status)

    // Print the domain created date
    fmt.Println(result.Domain.CreatedDate)

    // Print the domain expiration date
    fmt.Println(result.Domain.ExpirationDate)

    // Print the registrar name
    fmt.Println(result.Registrar.Name)

    // Print the registrant name
    fmt.Println(result.Registrant.Name)

    // Print the registrant email address
    fmt.Println(result.Registrant.Email)
}

Whois information query

Please refer to whois-go

License

Copyright 2014-2021 Li Kexian

Licensed under the Apache License 2.0

Donation

If this project is helpful, please share it with friends.

If you want to thank me, you can give me a cup of coffee.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDomainNotFound    = errors.New("Domain is not found.")
	ErrDomainInvalidData = errors.New("Domain whois data invalid.")
	ErrDomainLimitExceed = errors.New("Domain query limit exceeded.")
	ErrPremiumDomain     = errors.New("The domain is not registered, but available at a premium price.")
	ErrBlockedDomain     = errors.New("The domain name is blocked due to a DPML brand name block.")
)

Domain info error and replacer variables

Functions

func Author

func Author() string

Author returns package author

func ClearName

func ClearName(key string) string

ClearName returns cleared key name

func FindKeyName

func FindKeyName(key string) string

FindKeyName returns the mapper value by key

func FixDomainStatus

func FixDomainStatus(status []string) []string

FixDomainStatus returns fixed domain status

func FixNameServers

func FixNameServers(servers []string) []string

FixNameServers returns fixed name servers

func IsBlockedDomain added in v1.14.6

func IsBlockedDomain(data string) bool

IsBlockedDomain returns if the domain name is blocked due to a DPML brand name block

func IsDnsSecEnabled added in v1.14.0

func IsDnsSecEnabled(data string) bool

IsDnsSecEnabled returns dnssec is enabled

func IsLimitExceeded

func IsLimitExceeded(data string) bool

IsLimitExceeded returns is query limit

func IsNotFound

func IsNotFound(data string) bool

IsNotFound returns domain is not found

func IsPremiumDomain added in v1.14.6

func IsPremiumDomain(data string) bool

IsPremiumDomain returns if the domain name is available to register at a premium price

func Keys added in v1.2.0

func Keys(m map[string]string) []string

Keys returns all keys of map by sort

func License

func License() string

License returns package license

func Prepare added in v1.1.0

func Prepare(text, ext string) (string, bool)

Prepare do prepare the whois info for parsing

func Version

func Version() string

Version returns package version

Types

type Contact added in v1.9.0

type Contact struct {
	ID           string `json:"id,omitempty"`
	Name         string `json:"name,omitempty"`
	Organization string `json:"organization,omitempty"`
	Street       string `json:"street,omitempty"`
	City         string `json:"city,omitempty"`
	Province     string `json:"province,omitempty"`
	PostalCode   string `json:"postal_code,omitempty"`
	Country      string `json:"country,omitempty"`
	Phone        string `json:"phone,omitempty"`
	PhoneExt     string `json:"phone_ext,omitempty"`
	Fax          string `json:"fax,omitempty"`
	FaxExt       string `json:"fax_ext,omitempty"`
	Email        string `json:"email,omitempty"`
	ReferralURL  string `json:"referral_url,omitempty"`
}

Contact storing domain contact info

type Domain added in v1.9.0

type Domain struct {
	ID             string   `json:"id,omitempty"`
	Domain         string   `json:"domain,omitempty"`
	Punycode       string   `json:"punycode,omitempty"`
	Name           string   `json:"name,omitempty"`
	Extension      string   `json:"extension,omitempty"`
	WhoisServer    string   `json:"whois_server,omitempty"`
	Status         []string `json:"status,omitempty"`
	NameServers    []string `json:"name_servers,omitempty"`
	DnsSec         bool     `json:"dnssec,omitempty"`
	CreatedDate    string   `json:"created_date,omitempty"`
	UpdatedDate    string   `json:"updated_date,omitempty"`
	ExpirationDate string   `json:"expiration_date,omitempty"`
}

Domain storing domain name info

type WhoisInfo

type WhoisInfo struct {
	Domain         *Domain  `json:"domain,omitempty"`
	Registrar      *Contact `json:"registrar,omitempty"`
	Registrant     *Contact `json:"registrant,omitempty"`
	Administrative *Contact `json:"administrative,omitempty"`
	Technical      *Contact `json:"technical,omitempty"`
	Billing        *Contact `json:"billing,omitempty"`
}

WhoisInfo storing domain whois info

func Parse

func Parse(text string) (whoisInfo WhoisInfo, err error)

Parse returns parsed whois info

Jump to

Keyboard shortcuts

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