Documentation
¶
Index ¶
- Constants
- func HashData(src io.Reader) (string, error)
- func KeyGen(q Question) string
- func UnFqdn(s string) string
- func UpdateResolvConf()
- type Cache
- type CacheIsFull
- type KeyExpired
- type KeyNotFound
- type LocalData
- func (d *LocalData) DumpConfig() []byte
- func (d *LocalData) Get(domain string) ([]string, bool)
- func (h *LocalData) GetIpList(domain string, family int) ([]net.IP, bool)
- func (d *LocalData) ReplaceHosts(hosts map[string][]string)
- func (d *LocalData) ReplaceWildcardHosts(data map[string][]string)
- func (d *LocalData) ReplaceWildcardHostsWithBytes(buf []byte)
- type MemoryCache
- type Mesg
- type Question
- type RResp
- type ResolvError
- type Resolver
- type SerializerError
- type Server
- func (srv *Server) DoTCP(w dns.ResponseWriter, req *dns.Msg)
- func (srv *Server) DoUDP(w dns.ResponseWriter, req *dns.Msg)
- func (self *Server) DumpAllConfig() string
- func (self *Server) InitResolvConf()
- func (self *Server) ReplaceAddresses(data map[string][]string)
- func (self *Server) ReplaceDomainServers(data map[string][]string)
- func (self *Server) ReplaceHosts(data map[string][]string)
- func (srv *Server) Run()
- func (self *Server) RunResolvConf()
- func (srv *Server) Stop()
- func (self *Server) StopResolvConf()
Constants ¶
View Source
const ( HOSTS_PATH = "/etc/hosts" HOSTS_TTL = 600 RESOLV_CONF = "/etc/resolv.conf" RESOLV_TIMEOUT = 5 RESOLV_INTERVAL = 200 RESOLV_EDNS0_ON = true CACHE_EXPIRE = 600 // 10 minutes CACHE_MAXCOUNT = 20000 // If set zero. The Sum of cache itmes will be unlimit. )
View Source
const ResolvConfFilename = "/etc/resolv.conf"
Variables ¶
This section is empty.
Functions ¶
func UpdateResolvConf ¶
func UpdateResolvConf()
Types ¶
type CacheIsFull ¶
type CacheIsFull struct {
}
func (CacheIsFull) Error ¶
func (e CacheIsFull) Error() string
type KeyExpired ¶
type KeyExpired struct {
Key string
}
func (KeyExpired) Error ¶
func (e KeyExpired) Error() string
type KeyNotFound ¶
type KeyNotFound struct {
// contains filtered or unexported fields
}
func (KeyNotFound) Error ¶
func (e KeyNotFound) Error() string
type LocalData ¶
type LocalData struct {
// contains filtered or unexported fields
}
func NewLocalData ¶
func NewLocalData() *LocalData
func (*LocalData) DumpConfig ¶
func (*LocalData) ReplaceHosts ¶
func (*LocalData) ReplaceWildcardHosts ¶
func (*LocalData) ReplaceWildcardHostsWithBytes ¶
type MemoryCache ¶
type MemoryCache struct {
Backend map[string]Mesg
Expire time.Duration
Maxcount int
// contains filtered or unexported fields
}
func (*MemoryCache) Exists ¶
func (c *MemoryCache) Exists(key string) bool
func (*MemoryCache) Full ¶
func (c *MemoryCache) Full() bool
func (*MemoryCache) Length ¶
func (c *MemoryCache) Length() int
func (*MemoryCache) Remove ¶
func (c *MemoryCache) Remove(key string) error
type ResolvError ¶
type ResolvError struct {
// contains filtered or unexported fields
}
func (ResolvError) Error ¶
func (e ResolvError) Error() string
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func (*Resolver) DumpConfig ¶
func (*Resolver) Lookup ¶
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) ReplaceDomainServers ¶
func (*Resolver) UpdateResolvServers ¶
func (r *Resolver) UpdateResolvServers()
type SerializerError ¶
type SerializerError struct {
// contains filtered or unexported fields
}
func (SerializerError) Error ¶
func (e SerializerError) Error() string
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) DumpAllConfig ¶
func (*Server) InitResolvConf ¶
func (self *Server) InitResolvConf()
func (*Server) ReplaceAddresses ¶
func (*Server) ReplaceDomainServers ¶
func (*Server) ReplaceHosts ¶
func (*Server) RunResolvConf ¶
func (self *Server) RunResolvConf()
func (*Server) StopResolvConf ¶
func (self *Server) StopResolvConf()
Click to show internal directories.
Click to hide internal directories.