+
Skip to content

anikievev/whois

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WHOIS Client

a simple Go WHOIS Client API.

API

Lookup(ctx context.Context, domain, server string) (string, error)
WHOISHost(domain string) (string, error)
TLDs() []string

Install

go get github.com/twiny/whois/v2

Example

package main

import (
	"context"
	"fmt"
	"time"

	"github.com/twiny/whois/v2"
)

func main() {
	domain := "google.com"

	// to use Socks5 - this format 'socks5://username:password@alpha.hostname.com:1023'
	// otherwise use 'whois.Localhost' to use local connection
	client, err := whois.NewClient(whois.Localhost)
	if err != nil {
		fmt.Println(err)
		return
	}

	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	defer cancel()

	host, err := client.WHOISHost(domain)
	if err != nil {
		fmt.Println(err)
		return
	}

	resp, err := client.Lookup(ctx, "google.com", host)
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(resp)
	fmt.Println("done.")
}

Tracking

About

domain name WHOIS client.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载