godns

package module
v0.0.0-...-cec878f Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2015 License: BSD-3-Clause Imports: 8 Imported by: 0

README

godns

Fast DNS resolving with cache wraps miekg/dns

Deprecated in favor of: https://github.com/linkosmos/redial

Build Status GoDoc BSD License

Documentation

Index

Constants

View Source
const DefaultNameServer = "8.8.8.8:53"

DefaultNameServer - Google

Variables

View Source
var ErrEmptyIPS = errors.New("No IP's for a given hostport")

ErrEmptyIPS - no IP's were found for given hostport

Functions

This section is empty.

Types

type Pool

type Pool struct {
	NameServer string
	Randomize  bool

	Timeout, StepTimeout, RetryWait time.Duration
	// contains filtered or unexported fields
}

Pool - for caching DNS records and easy retrieval

func New

func New() *Pool

New - returns new dns records pool

func (*Pool) Get

func (p *Pool) Get(hostport string) (*net.TCPAddr, error)

Get - retuns first or random IP assigned to hostport

func (*Pool) ResolveName

func (p *Pool) ResolveName(name, nameserver string) (addrs []net.IP, dur time.Duration, err error)

ResolveName - resolves name for given host and returns array of IP's

type TCPMap

type TCPMap map[string][]*net.TCPAddr

TCPMap - map of host+port and resolved IP's, added some syntactic sugar and convenience methods

func (*TCPMap) Add

func (t *TCPMap) Add(hostport string, ip net.IP, port int)

Add -

func (*TCPMap) BulkAdd

func (t *TCPMap) BulkAdd(hostport string, ips []net.IP, port int)

BulkAdd - convenience method to iterate array of IP's and Add them

func (*TCPMap) Exist

func (t *TCPMap) Exist(hostport string) bool

Exist - checks whether hostport exist

func (*TCPMap) Get

func (t *TCPMap) Get(hostport string, randomize bool) (*net.TCPAddr, error)

Get - returns random IP address if more than 1

func (*TCPMap) Len

func (t *TCPMap) Len(hostport string) int

Len - returns size of IP addresses for hostport

Directories

Path Synopsis
Godeps
_workspace/src/github.com/golang/glog
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
_workspace/src/github.com/miekg/dns
Package dns implements a full featured interface to the Domain Name System.
Package dns implements a full featured interface to the Domain Name System.
_workspace/src/github.com/miekg/dns/idn
Package idn implements encoding from and to punycode as speficied by RFC 3492.
Package idn implements encoding from and to punycode as speficied by RFC 3492.

Jump to

Keyboard shortcuts

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