whois_parser

package module
v0.0.0-...-5f6d786 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2018 License: Apache-2.0 Imports: 3 Imported by: 1

README

whois-parser.go

whois-parser-go is a simple Go module for whois info parser.

Build Status

Overview

It will parse the provided whois information and return a readable data struct.

Works for most domain extensions most of the time.

Installation

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

Importing

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

Documentation

func Parse(whois string) (whois_info WhoisInfo, err error)

Example

result, err := whois_parser.Parse(whois_raw)
if err == nil {
    // Print the domain status
    fmt.Println(result.Registrar.DomainStatus)

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

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

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

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

Whois info query in Go

Please refer to whois-go

LICENSE

Copyright 2014-2018, Li Kexian

Apache License, Version 2.0

DONATE

About

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DomainInvalidDataError = errors.New("Domain whois data invalid.")
View Source
var DomainLimitExceededError = errors.New("Your connection limit exceeded.")
View Source
var DomainNotFoundError = errors.New("Domain is not found.")

Functions

func FixNameServers

func FixNameServers(nservers string) string

func IsLimitExceeded

func IsLimitExceeded(data string) (result bool)

func IsNotFound

func IsNotFound(data string) (result bool)

func ReadFile

func ReadFile(file string) (str string, err error)

func RemoveDuplicateField

func RemoveDuplicateField(data string) string

func StringInArray

func StringInArray(array []string, find string) bool

func TransferName

func TransferName(name string) string

func WriteFile

func WriteFile(file string, data string) error

Types

type Registrant

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

type Registrar

type Registrar struct {
	RegistrarID    string `json:"registrar_id"`
	RegistrarName  string `json:"registrar_name"`
	WhoisServer    string `json:"whois_server"`
	ReferralURL    string `json:"referral_url"`
	DomainId       string `json:"domain_id"`
	DomainName     string `json:"domain_name"`
	DomainStatus   string `json:"domain_status"`
	NameServers    string `json:"name_servers"`
	DomainDNSSEC   string `json:"domain_dnssec"`
	CreatedDate    string `json:"created_date"`
	UpdatedDate    string `json:"updated_date"`
	ExpirationDate string `json:"expiration_date"`
}

type WhoisInfo

type WhoisInfo struct {
	Registrar  Registrar  `json:"registrar"`
	Registrant Registrant `json:"registrant"`
	Admin      Registrant `json:"admin"`
	Tech       Registrant `json:"tech"`
	Bill       Registrant `json:"bill"`
}

func Parse

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

Jump to

Keyboard shortcuts

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