whois

package module
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 12 Imported by: 1

README

WHOIS Client

a simple Go WHOIS Client API. It supports custom proxy.Dialer for Socks5.

API

Query(ctx context.Context, domain string) (Response, error)

Install

go get github.com/twiny/whois/v2

Example

package main

import (
 "context"
 "fmt"

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

func main() {
 client, err := whois.NewClient(nil)
 if err != nil {
  fmt.Printf("err: %s\n", err)
 }

 resp, err := client.Query(context.TODO(), "google.com")
 if err != nil {
  fmt.Printf("err: %s\n", err)
 }

 // Print the response
 fmt.Printf("Domain: %+v\n", resp)
}

Tracking

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(dialer proxy.Dialer) (*Client, error)

NewClient: create a new WHOIS client, if dialer is nil, it will use the default dialer

func (*Client) Query added in v2.1.0

func (c *Client) Query(ctx context.Context, domain string) (Response, error)

Query: return raw WHOIS information for a domain

type Response added in v2.1.0

type Response struct {
	Domain    string
	Name      string
	TLD       string
	WHOISHost string
	WHOISRaw  string
}

Jump to

Keyboard shortcuts

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