resolver

package module
v0.0.0-...-2fe6f36 Latest Latest
Warning

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

Go to latest
Published: May 9, 2018 License: GPL-3.0 Imports: 7 Imported by: 2

README

resolver

Go Report Card Documentation

Package resolver allows performing DNS queries such as resolving a DNS name querying some records, DNS zone transferences and reverse IP lookups.

Install

go get -u github.com/jimen0/resolver/...

Usage

Read the tests (:

Test

Just run go test -race -v github.com/jimen0/resolver/...

Improvements

Send a PR or open an issue. Just make sure that your PR passes gofmt, golint and govet.

Documentation

Overview

Package resolver allows performing DNS queries such as resolving a DNS name querying some records, DNS zone transferences and reverse IP lookups.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoResponse = errors.New("no response")

ErrNoResponse is returned when all resolution retries were done and no response has been received yet.

Functions

func Resolve

func Resolve(ctx context.Context, record, host string, retries int, srv []string) ([]string, error)

Resolve tries to resolve a host using the given DNS servers. If all servers fail to resolve it, Resolve returns an error

func ZoneTransfer

func ZoneTransfer(host, server string, port int) ([]string, error)

ZoneTransfer performs a Zone Transfer request.

Types

type Resolver

type Resolver struct {
	// Record is the DNS record that is queried.
	Record string
	// Retries is the number of retries done.
	Retries int
	// Workers is the number of concurrent goroutines used during resolution.
	Workers int
}

Resolver represents a DNS resolver.

func New

func New(record string, retries, workers int) (*Resolver, error)

New creates a DNS resolver.

func (*Resolver) ResolveList

func (r *Resolver) ResolveList(ctx context.Context, domains, servers []string, out chan<- Result) error

ResolveList resolves a slice of hosts and returns the destintations they resolve to over the out channel.

type Result

type Result struct {
	// Name is the domain name.
	Name string
	// Destination is the list of addresses where it resolves to.
	Destination []string
}

Result represents a domain name and its destinations.

Jump to

Keyboard shortcuts

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