1 package dns01 2 3 import ( 4 "strings" 5 6 "github.com/miekg/dns" 7 ) 8 9 // Update FQDN with CNAME if any. 10 func updateDomainWithCName(r *dns.Msg, fqdn string) string { 11 for _, rr := range r.Answer { 12 if cn, ok := rr.(*dns.CNAME); ok { 13 if strings.EqualFold(cn.Hdr.Name, fqdn) { 14 return cn.Target 15 } 16 } 17 } 18 19 return fqdn 20 } 21