srvdns

package
v0.0.0-...-f715ac0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package srvdns handles all the DNS stuff.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(addr string, fwd string, cache int64, http string, v int) (*dns.Server, *dns.Server)

Serve DNS requests.

TODO: Splitting out the binding of the socket and starting a server is not easy with the dns API, so we don't for now.

Types

type CacheEntry

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

CacheEntry is a single cached entry

type CacheList

type CacheList struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CacheList is the list of all caches entries.

var Cache CacheList

Cache of spoofing actions.

We don't cache the actual DNS responses − that's the resolver's job. We just cache the action taken. That's enough and saves some time in processing regexps and such

func (*CacheList) Delete

func (l *CacheList) Delete(keys ...string)

Delete items.

func (*CacheList) Dump

func (l *CacheList) Dump(w io.Writer)

Dump all keys to the writer.

func (*CacheList) Get

func (l *CacheList) Get(k string) (CacheEntry, bool)

Get a single item.

func (*CacheList) Len

func (l *CacheList) Len() int

Len returns the length of the map.

func (*CacheList) Purge

func (l *CacheList) Purge()

Purge the entire cache

func (*CacheList) PurgeExpired

func (l *CacheList) PurgeExpired(max int)

PurgeExpired removes old cache items.

func (*CacheList) Store

func (l *CacheList) Store(k string, entry CacheEntry)

Store an item.

Jump to

Keyboard shortcuts

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