diff --git a/dns/resolver.go b/dns/resolver.go index 96da175..fa20764 100644 --- a/dns/resolver.go +++ b/dns/resolver.go @@ -162,7 +162,7 @@ func (r *Resolver) exchangeWithoutCache(ctx context.Context, m *D.Msg) (msg *D.M msg := result.(*D.Msg) - putMsgToCache(r.lruCache, q.String(), msg) + putMsgToCache(r.lruCache, q.String(), q, msg) }() isIPReq := isIPRequest(q) diff --git a/dns/util.go b/dns/util.go index 05c734e..90d2ff9 100644 --- a/dns/util.go +++ b/dns/util.go @@ -16,9 +16,9 @@ import ( D "github.com/miekg/dns" ) -func putMsgToCache(c *cache.LruCache, key string, msg *D.Msg) { +func putMsgToCache(c *cache.LruCache, key string, q D.Question, msg *D.Msg) { // skip dns cache for acme challenge - if q := msg.Question[0]; q.Qtype == D.TypeTXT && strings.HasPrefix(q.Name, "_acme-challenge") { + if q.Qtype == D.TypeTXT && strings.HasPrefix(q.Name, "_acme-challenge.") { log.Debugln("[DNS] dns cache ignored because of acme challenge for: %s", q.Name) return }