Documentation ¶
Index ¶
- Constants
- func BindToDevice(fd int, device string) error
- type Cache
- type CacheOptions
- type Item
- type Server
- func (s *Server) Addr() string
- func (s *Server) HandleForwarding(w mdns.ResponseWriter, r *mdns.Msg) (bool, error)
- func (s *Server) HandleVIC(w mdns.ResponseWriter, r *mdns.Msg) (bool, error)
- func (s *Server) SeenBefore(w mdns.ResponseWriter, r *mdns.Msg) (bool, error)
- func (s *Server) ServeDNS(w mdns.ResponseWriter, r *mdns.Msg)
- func (s *Server) Start()
- func (s *Server) Stop()
- func (s *Server) Wait()
- type ServerOptions
- type SetOfDomains
Constants ¶
View Source
const ( DefaultIP = "127.0.0.1" DefaultPort = 53 DefaultTTL = 600 * time.Second DefaultCacheSize = 1024 DefaultTimeout = 4 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func BindToDevice ¶
BindToDevice binds the socket associated with fd to device.
Types ¶
type Cache ¶
type Cache struct { CacheOptions // Protects following map sync.RWMutex // contains filtered or unexported fields }
Cache stores dns.Msgs and their expiration time
type CacheOptions ¶
type CacheOptions struct {
// contains filtered or unexported fields
}
CacheOptions represents the cache options
type Server ¶
type Server struct { ServerOptions // contains filtered or unexported fields }
Server represents udp/tcp server and clients
func (*Server) HandleForwarding ¶
HandleForwarding forwards a request to the nameservers and returns the response
func (*Server) SeenBefore ¶
SeenBefore returns the cached response
type ServerOptions ¶
type ServerOptions struct { IP string Port int Interface string Nameservers flagMultipleVar Timeout time.Duration TTL time.Duration CacheSize int Debug bool }
ServerOptions represents the server options
type SetOfDomains ¶
SetOfDomains is a type for storing string-type domain names as an unsorted set
var f SetOfDomains f = make(map[string]bool)
Store in the set
f["foo.com"] = true
then to check to see if something is in the 'set':
if f["foo.com"] {
func ReverseLookup ¶
func ReverseLookup(ipAddr string) (domains SetOfDomains)
ReverseLookup returns a set of FQDNs for ipAddr from nameservers in /etc/resolv.conf /etc/hosts and /etc/nsswitch.conf are ignored by this function
Click to show internal directories.
Click to hide internal directories.