dns

package
v1.24.4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTTL       = uint32(3600)
	CleanupInterval  = time.Second * 120
	CleanupThreshold = 512
)
View Source
const (
	APP_ID = app.ID(2)
)
View Source
const (
	QueryTimeout = time.Second * 8
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ARecord

type ARecord struct {
	IPs    []net.IP
	Expire time.Time
}

type CacheServer

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

func NewCacheServer

func NewCacheServer(space app.Space, config *Config) *CacheServer

func (*CacheServer) Get

func (this *CacheServer) Get(domain string) []net.IP

func (*CacheServer) GetCached

func (this *CacheServer) GetCached(domain string) []net.IP

@Private

func (*CacheServer) Release

func (this *CacheServer) Release()

type Config

type Config struct {
	Hosts       map[string]net.IP
	NameServers []v2net.Destination
}

type DomainRecord

type DomainRecord struct {
	A *ARecord
}

type LocalNameServer

type LocalNameServer struct {
}

func (*LocalNameServer) QueryA

func (this *LocalNameServer) QueryA(domain string) <-chan *ARecord

type NameServer

type NameServer interface {
	QueryA(domain string) <-chan *ARecord
}

type PendingRequest

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

type Server

type Server interface {
	Get(domain string) []net.IP
}

A DnsCache is an internal cache of DNS resolutions.

type UDPNameServer

type UDPNameServer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewUDPNameServer

func NewUDPNameServer(address v2net.Destination, dispatcher dispatcher.PacketDispatcher) *UDPNameServer

func (*UDPNameServer) AssignUnusedID

func (this *UDPNameServer) AssignUnusedID(response chan<- *ARecord) uint16

@Private

func (*UDPNameServer) BuildQueryA

func (this *UDPNameServer) BuildQueryA(domain string, id uint16) *alloc.Buffer

func (*UDPNameServer) Cleanup

func (this *UDPNameServer) Cleanup()

@Private

func (*UDPNameServer) DispatchQuery

func (this *UDPNameServer) DispatchQuery(payload *alloc.Buffer)

func (*UDPNameServer) HandleResponse

func (this *UDPNameServer) HandleResponse(dest v2net.Destination, payload *alloc.Buffer)

@Private

func (*UDPNameServer) QueryA

func (this *UDPNameServer) QueryA(domain string) <-chan *ARecord

Jump to

Keyboard shortcuts

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