From d56b459d9ad7406c50439dc33a18e3f8f2570d03 Mon Sep 17 00:00:00 2001 From: Niklas Date: Mon, 1 Feb 2021 00:03:38 +0100 Subject: [PATCH] resolve CNAME --- internal/cooldns.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/cooldns.go b/internal/cooldns.go index 1c8ae35..b6d93af 100644 --- a/internal/cooldns.go +++ b/internal/cooldns.go @@ -409,6 +409,14 @@ func handleRequest(w dns.ResponseWriter, r *dns.Msg, zone zoneView) { m.Extra = append(m.Extra, zone.rr[dns.TypeAAAA][t.Ns]...) } } + case dns.TypeCNAME: + // Resolve CNAME + for _, cnameRR := range m.Answer { + if t, ok := cnameRR.(*dns.CNAME); ok { + m.Extra = append(m.Extra, zone.rr[dns.TypeA][t.Target]...) + m.Extra = append(m.Extra, zone.rr[dns.TypeAAAA][t.Target]...) + } + } } if len(m.Answer) == 0 {