resolve CNAME

This commit is contained in:
Niklas 2021-02-01 00:03:38 +01:00
parent 0336002980
commit d56b459d9a

View File

@ -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]...) 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 { if len(m.Answer) == 0 {