resolver

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 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 NewWithResolve added in v0.11.4

func NewWithResolve(resolveFunc func(string) ([]net.IP, error)) *Resolver

NewWithResolve returns a new Resolver with the given backend resolver. This is useful for testing.

func (*Resolver) Resolve

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

Resolve returns IP address for a name. Issues an update call for the cache record if it's older than defaultMaxAge.

Jump to

Keyboard shortcuts

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