fix: dns cache index out of range
This commit is contained in:
parent
0035fc2313
commit
0c9a23a53c
1 changed files with 5 additions and 3 deletions
|
@ -29,10 +29,12 @@ const (
|
||||||
|
|
||||||
func putMsgToCache(c *cache.LruCache[string, *D.Msg], key string, msg *D.Msg) {
|
func putMsgToCache(c *cache.LruCache[string, *D.Msg], key string, msg *D.Msg) {
|
||||||
// skip dns cache for acme challenge
|
// skip dns cache for acme challenge
|
||||||
|
if len(msg.Question) != 0 {
|
||||||
if q := msg.Question[0]; q.Qtype == D.TypeTXT && strings.HasPrefix(q.Name, "_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)
|
log.Debugln("[DNS] dns cache ignored because of acme challenge for: %s", q.Name)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
var ttl uint32
|
var ttl uint32
|
||||||
switch {
|
switch {
|
||||||
case len(msg.Answer) != 0:
|
case len(msg.Answer) != 0:
|
||||||
|
|
Loading…
Reference in a new issue