nameresolver

package
v0.0.0-...-3d855e8 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: BSD-2-Clause Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const MAX_CNAME_CHAIN = 10

MAX_CNAME_CHAIN indicates the longest chain of CNAME that is acceptable to be followed a name is considered a dead-end (i.e. unfit for name resolution)

View Source
const REQ_CHAN_CAPACITY = 10

REQ_CHAN_CAPACITY is the capacity of the channel into which are submitted new requests. This is used as a back off mechanism if the submitter is much faster than the finder.

View Source
const WORKER_CHAN_CAPACITY = 10

WORKER_CHAN_CAPACITY indicates the maximum number of request unhandled by the start() goroutine can be spooled before the call to Handle() becomes blocking.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finder

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

Finder is a worker pool maintainer for resolution of domain names into aliases or IP addresses.

func NewFinder

func NewFinder(zcHandler func(*zonecut.Request) *errors.ErrorStack, conf *tools.TransdepConfig) *Finder
NewFinder instantiates a new Finder

zcHandler is a function that may be called to submit new requests for zone cut/delegation info discovery.

maxWorkerCount is the number of concurrent workers that will be maintained by this finder. Once this number of workers reached, the Finder will shut down those that were the least recently used (LRU).

cacheRootDir is the root directory for caching. Workers that are shut down store the result that they are distributing into a cache file, for later use.

func (*Finder) Handle

func (nr *Finder) Handle(req *nameresolver.Request) *errors.ErrorStack

Handle is the method to call to submit new name resolution requests. An error might be returned if this finder is already stopping.

func (*Finder) Stop

func (nr *Finder) Stop() bool

Stop signals that no new requests will be submitted. It triggers some cleanup of the remaining live workers, wait for them to finish and then returns true. Subsequent calls to Stop will return false as the finder is already stopped.

Jump to

Keyboard shortcuts

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