dns

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Cachning DNS resolver.

This package has a global instance of caching DNS service.

Index

Constants

View Source
const (
	// CacheSize is a size of DNS cache.
	CacheSize = 512

	// CacheTTL is a TTL of a DNS record in a cache.
	CacheTTL = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DNS

type DNS struct {
	// contains filtered or unexported fields
}

DNS is a caching resolver.

func (*DNS) Lookup

func (d *DNS) Lookup(ctx context.Context, hostname string) (hosts []string, err error)

Lookup to conform Interface.

type Interface

type Interface interface {
	// Lookup returns resolved IPs for given hostname/ips. Important
	// property is that this list is shuffled on each function
	// execution.
	Lookup(context.Context, string) ([]string, error)
}

Interface is an interface for cachind DNS resolver.

Default is a default DNS resolver you usually want to use everywhere.

func New

func New(cacheSize int, cacheTTL time.Duration, evictCallback cache.EvictCallback) Interface

New returns a new instance of DNS cache.

Jump to

Keyboard shortcuts

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