dnscache

package
v0.0.0-...-b003ea2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSCache

type DNSCache struct {
	Logger            *zap.Logger
	MaxLookupAttempts int
	DialTimeout       time.Duration
	// contains filtered or unexported fields
}

DNSCache is a net.Resolver compliant DNS Resolver

func New

func New(logger *zap.Logger) *DNSCache

New creates a new DNSCache

func (*DNSCache) Add

func (cache *DNSCache) Add(record ...dns.RR) error

Add adds a static entry to the cache

func (*DNSCache) Addr

func (cache *DNSCache) Addr() string

Addr returns the listening address of the server

func (*DNSCache) Close

func (cache *DNSCache) Close()

Close closes an DNSCache Server (started with Server())

func (*DNSCache) Lookup

func (cache *DNSCache) Lookup(host string, Qclass uint16, Qtype uint16) ([]dns.RR, error)

Lookup looks up an entry in the cache

func (*DNSCache) ResolveAndAdd

func (cache *DNSCache) ResolveAndAdd(dnsServer, net string, host string, Qclass uint16, Qtype uint16) error

ResolveAndAdd resolves and adds the result to the cache

func (*DNSCache) Resolver

func (cache *DNSCache) Resolver() *net.Resolver

Resolver returns an net.Resolver that can be used

func (*DNSCache) Server

func (cache *DNSCache) Server() error

Server starts a DNSCache server

func (*DNSCache) Truncate

func (cache *DNSCache) Truncate() error

Truncate truncates the cache

Jump to

Keyboard shortcuts

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