ddns

package
v0.0.0-...-2403d1f Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyGen

func KeyGen(q Question) string

func UnFqdn

func UnFqdn(s string) string

Types

type Cache

type Cache interface {
	Get(key string) (*dns.Msg, error)
	Set(key string, Msg *dns.Msg) error
	Exists(key string) bool
	Remove(key string)
	Length() int
}

func NewMemCache

func NewMemCache(defExpire int) (Cache, error)

func NewRedisCache

func NewRedisCache(key string, db int, defExpire int) (Cache, error)

type DBRecodes

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

func NewDBRecodes

func NewDBRecodes(db model.IDatabase) *DBRecodes

func (*DBRecodes) GetAddrCname

func (d *DBRecodes) GetAddrCname(domain string, qtype uint16) []recode

func (*DBRecodes) GetAddress

func (d *DBRecodes) GetAddress(domain string, qtype uint16) []recode

func (*DBRecodes) GetCNAMERecode

func (d *DBRecodes) GetCNAMERecode(domain string) *recode

func (*DBRecodes) ReverseGet

func (d *DBRecodes) ReverseGet(name string) []recode

type DDNSHandler

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

func NewHandler

func NewHandler(db model.IDatabase) *DDNSHandler

func (*DDNSHandler) AddrRecode

func (h *DDNSHandler) AddrRecode(domain string, qtype uint16, prrs []dns.RR) (rrs []dns.RR)

func (*DDNSHandler) CNAMERecode

func (h *DDNSHandler) CNAMERecode(name string) (rs []dns.RR)

func (*DDNSHandler) DoTCP

func (h *DDNSHandler) DoTCP(w dns.ResponseWriter, req *dns.Msg)

func (*DDNSHandler) DoUDP

func (h *DDNSHandler) DoUDP(w dns.ResponseWriter, req *dns.Msg)

func (*DDNSHandler) PTRRecords

func (h *DDNSHandler) PTRRecords(q dns.Question) (records []dns.RR, err error)

func (*DDNSHandler) ServeDNSReverse

func (h *DDNSHandler) ServeDNSReverse(w dns.ResponseWriter, req *dns.Msg) *dns.Msg

ServeDNSReverse is the handler for DNS requests for the reverse zone. If nothing is found locally the request is forwarded to the forwarder for resolution.

type FileHosts

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

func (*FileHosts) Get

func (f *FileHosts) Get(domain string) ([]string, bool)

func (*FileHosts) Refresh

func (f *FileHosts) Refresh()

type Hosts

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

func NewHosts

func NewHosts(hs config.HostsSettings) Hosts

func (*Hosts) Get

func (h *Hosts) Get(domain string, qtype uint16) ([]net.IP, bool)

type NetType

type NetType int
const (
	NetTCP NetType = 1
	NetUDP         = 2
)

type Question

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

func (*Question) String

func (q *Question) String() string

type ResolvError

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

ResolvError ...

func (ResolvError) Error

func (e ResolvError) Error() string

type Resolver

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

Resolver ...

func (*Resolver) Lookup

func (r *Resolver) Lookup(netType NetType, req *dns.Msg) (message *dns.Msg, err error)

Lookup will ask each nameserver in top-to-bottom fashion, starting a new request in every second, and return as early as possbile (have an answer). It returns an error if no request has succeeded.

func (*Resolver) Nameservers

func (r *Resolver) Nameservers() (ns []string)

Nameservers return the array of nameservers, with port number appended. '#' in the name is treated as port separator, as with dnsmasq.

func (*Resolver) Timeout

func (r *Resolver) Timeout() time.Duration

Timeout ...

type Server

type Server struct {
	Host     string
	Port     int
	RTimeout time.Duration
	WTimeout time.Duration

	Db model.IDatabase
	// contains filtered or unexported fields
}

func (*Server) Addr

func (s *Server) Addr() string

func (*Server) Run

func (s *Server) Run()

func (*Server) Stop

func (s *Server) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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