retryabledns

package
v0.0.0-...-34b1662 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 12 Imported by: 0

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
}

Client is a DNS resolver client to resolve hostnames.

func New

func New(dnsTimeOut int, maxRetries int, errorLimit int) *Client

New creates a new dns client

func (*Client) Do

func (c *Client) Do(msg *dns.Msg) (resp *dns.Msg, err error)

Do sends a provided dns request and return the raw native response

func (*Client) Query

func (c *Client) Query(host string, requestType uint16, customDNSServer string) (*DNSData, error)

Query sends a provided dns request and return enriched response

func (*Client) QueryMultiple

func (c *Client) QueryMultiple(host string, requestTypes []uint16, customDNSServer string) (*DNSData, error)

QueryMultiple sends a provided dns request and return the data

func (*Client) Resolve

func (c *Client) Resolve(host string) (*DNSData, error)

Resolve is the underlying resolve function that actually resolves a host and gets the ip records for that host.

type DNSData

type DNSData struct {
	Host       string   `json:"host,omitempty"`
	TTL        int      `json:"ttl,omitempty"`
	Resolver   []string `json:"resolver,omitempty"`
	A          []string `json:"a,omitempty"`
	AAAA       []string `json:"aaaa,omitempty"`
	CNAME      []string `json:"cname,omitempty"`
	MX         []string `json:"mx,omitempty"`
	PTR        []string `json:"ptr,omitempty"`
	SOA        []string `json:"soa,omitempty"`
	NS         []string `json:"ns,omitempty"`
	TXT        []string `json:"txt,omitempty"`
	Raw        string   `json:"raw,omitempty"`
	StatusCode string   `json:"status_code,omitempty"`
	OriRes     string
	OriReq     string
}

DNSData desc

func (*DNSData) JSON

func (d *DNSData) JSON() (string, error)

JSON returns the object as json string

func (*DNSData) Marshal

func (d *DNSData) Marshal() ([]byte, error)

Marshal desc

func (*DNSData) ParseFromMsg

func (d *DNSData) ParseFromMsg(msg *dns.Msg) error

ParseFromMsg and enrich data

func (*DNSData) Unmarshal

func (d *DNSData) Unmarshal(b []byte) error

Unmarshal desc

Jump to

Keyboard shortcuts

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