From 4a579177833f6cec6014d8894cf985f6689b5f26 Mon Sep 17 00:00:00 2001 From: ALICE Date: Thu, 22 Dec 2022 13:30:23 +0800 Subject: [PATCH] Chore: skip cache acme challenge dns msg (#2469) --- dns/util.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dns/util.go b/dns/util.go index df3a3331..05c734e8 100644 --- a/dns/util.go +++ b/dns/util.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "net" + "strings" "time" "github.com/Dreamacro/clash/common/cache" @@ -16,6 +17,12 @@ import ( ) func putMsgToCache(c *cache.LruCache, key string, msg *D.Msg) { + // skip dns cache for acme challenge + if q := msg.Question[0]; 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 + } + var ttl uint32 switch { case len(msg.Answer) != 0: