// NewHandler returns a new DNSHandler
NewHandler returns a new DNSHandler
// NewHandler returns a new DNSHandler
func NewHandler(config *Config, blockCache *MemoryBlockCache, questionCache *MemoryQuestionCache) *DNSHandler {
	var (
		clientConfig *dns.ClientConfig
		resolver     *Resolver
		cache        Cache
		negCache     Cache
	)
	resolver = &Resolver{clientConfig}
	cache = &MemoryCache{
		Backend:  make(map[string]*Mesg, config.Maxcount),
		Maxcount: config.Maxcount,
	}
	negCache = &MemoryCache{
		Backend:  make(map[string]*Mesg),
		Maxcount: config.Maxcount,
	}
	handler := &DNSHandler{
		requestChannel: make(chan DNSOperationData),
		resolver:       resolver,
		cache:          cache,
		negCache:       negCache,
	}
	go handler.do(config, blockCache, questionCache)
	go (func(handler *DNSHandler) {
		for range time.Tick(time.Second * 60) {
			atomic.StoreInt32(&handler.QueryRateCounter, 0)
		}
	})(handler)
	return handler
}
func NewHandler ( config * Config , blockCache * MemoryBlockCache , questionCache * MemoryQuestionCache ) * DNSHandler { var ( clientConfig * dns . ClientConfig resolver * Resolver cache Cache negCache Cache ) resolver = & Resolver { clientConfig } cache = & MemoryCache { Backend : make ( map [ string ] * Mesg , config . Maxcount ) , Maxcount : config . Maxcount , } negCache = & MemoryCache { Backend : make ( map [ string ] * Mesg ) , Maxcount : config . Maxcount , } handler := & DNSHandler { requestChannel : make ( chan DNSOperationData ) , resolver : resolver , cache : cache , negCache : negCache , } go handler . do ( config , blockCache , questionCache ) go ( func ( handler * DNSHandler ) { for range time . Tick ( time . Second * 60 ) { atomic . StoreInt32 ( & handler . QueryRateCounter , 0 ) } } ) ( handler ) return handler }
NewHandler returns a new DNSHandler
NewHandler returns a new DNSHandler