all: add flush cache domains config

This commit is contained in:
Cuong Manh Le
2024-03-14 20:02:44 +07:00
committed by Cuong Manh Le
parent 34ebe9b054
commit b50cccac85
7 changed files with 74 additions and 32 deletions
+4
View File
@@ -101,6 +101,10 @@ func (p *prog) serveDNS(listenerNum string) error {
go p.detectLoop(m)
q := m.Question[0]
domain := canonicalName(q.Name)
if _, ok := p.cacheFlushDomainsMap[domain]; ok && p.cache != nil {
p.cache.Purge()
ctrld.Log(ctx, mainLog.Load().Debug(), "received query %q, local cache is purged", domain)
}
remoteIP, _, _ := net.SplitHostPort(w.RemoteAddr().String())
ci := p.getClientInfo(remoteIP, m)
ci.ClientIDPref = p.cfg.Service.ClientIDPref