Help us shape the future of Go! Take the 2026 Go Developer Survey

whois

package module
v0.0.0-...-961b3b5 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

README

golang-whois

golang-whois is light golang module for checking domain's whois using root servers.

Overview

whois.go: A golang module for domain whois query.

servers.go: Worldwide servers list for getting whois info.

extra.go: some extra functions to parse whois info

Installation

go get github.com/x0data/whois

Importing

import (
    "github.com/x0data/whois"
)

How to use

func GetWhois(domain string) (result string, err error)

func GetWhoisTimeout(domain string, timeout time.Duration) (result string, err error)

GetLabelMust(body []byte, label string) string 

Example

if res, ok, err := whois.GetWhois("att.com"); ok {
		println(string(whois.GetLabelMust(res, "Domain Name")))
		println(string(whois.GetLabelMust(res, "Registrant Organization")))
		println(string(whois.GetLabelMust(res, "Registrant Email")))
		println(string(whois.GetLabelMust(res, "Registrant Phone")))

		println(string(whois.GetLabelMust(res, "Admin Organization")))
		println(string(whois.GetLabelMust(res, "Admin Email")))
		println(string(whois.GetLabelMust(res, "Admin Phone")))

		println(string(whois.GetLabelMust(res, "Tech Organization")))
		println(string(whois.GetLabelMust(res, "Tech Email")))
		println(string(whois.GetLabelMust(res, "Tech Phone")))
	} else {
		println("[E]", err)
	}

LICENSE

Copyright 2019, undiabler, Lanzay

Apache License, Version 2.0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	REGISTRATOR_WHOIS = []byte("Registrar WHOIS Server")
	NO_MATCH          = []byte("No match")
	LABEL_SUFFIX      = []byte(": ")
)

Functions

func GetLabel

func GetLabel(body []byte, label []byte) ([]byte, bool)

func GetLabelMust

func GetLabelMust(body []byte, label string) string

func GetWhois

func GetWhois(domain string) ([]byte, bool, error)

Simple connection to whois servers with default timeout 5 sec

func GetWhoisArr

func GetWhoisArr(domains []string)

func GetWhoisTimeout

func GetWhoisTimeout(domain string, timeout time.Duration) ([]byte, bool, error)

Connection to whois servers with various time.Duration

func ParseDomainStatus

func ParseDomainStatus(whois string) []string

Parse uniq domain status(codes) from whois

func ParseNameServers

func ParseNameServers(whois string) []string

Parse uniq name servers from whois

Types

This section is empty.

Jump to

Keyboard shortcuts

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