resolver

package
v3.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package resolver is a simple dns resolver based on miekg/dns

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotResolve = errors.New("cannot resolve this domain, please make sure the IP type is right")
View Source
var ErrEmptyResult = errors.New("empty result")

Functions

func ResolveDNS

func ResolveDNS(hostname, resolver, ipType string) (string, error)

ResolveDNS will query DNS for a given hostname. example: ResolveDNS(`webx.top`,`8.8.8.8`,`IPV4`)

Types

type DNSResolver

type DNSResolver struct {
	Servers    []string
	RetryTimes int
	// contains filtered or unexported fields
}

DNSResolver represents a dns resolver

func New

func New(servers []string) *DNSResolver

New initializes DnsResolver.

func NewFromResolvConf

func NewFromResolvConf(path string) (*DNSResolver, error)

NewFromResolvConf initializes DnsResolver from resolv.conf like file.

func (*DNSResolver) LookupHost

func (r *DNSResolver) LookupHost(host string, dnsType uint16) ([]net.IP, error)

LookupHost returns IP addresses of provied host. In case of timeout retries query RetryTimes times.

Jump to

Keyboard shortcuts

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