resolver

package
v0.0.0-...-b28dce8 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package resolver provides a caching, non-blocking DNS resolver. All requests for cached resources are returned immediately and if cache has expired, an offline goroutine is fired to update it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolver

type Resolver struct {
	DefaultMaxAge time.Duration
	// contains filtered or unexported fields
}

Resolver provides an asynchronous caching DNS resolver.

func New

func New() *Resolver

New returns a new Resolver.

func (*Resolver) Resolve

func (r *Resolver) Resolve(name string, ipVer int) (net.IP, error)

Resolve returns IP address for a name. It's same as ResolveWithMaxAge, except for that it uses DefaultMaxAge for validating the cache record.

func (*Resolver) ResolveWithMaxAge

func (r *Resolver) ResolveWithMaxAge(name string, ipVer int, maxAge time.Duration) (net.IP, error)

ResolveWithMaxAge returns IP address for a name, issuing an update call for the cache record if it's older than the argument maxAge.

Jump to

Keyboard shortcuts

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