2020-05-05 04:12:34 +00:00
|
|
|
package dns01
|
|
|
|
|
|
|
|
import "github.com/miekg/dns"
|
|
|
|
|
2020-05-22 10:08:01 +00:00
|
|
|
// Update FQDN with CNAME if any.
|
2020-05-05 04:12:34 +00:00
|
|
|
func updateDomainWithCName(r *dns.Msg, fqdn string) string {
|
|
|
|
for _, rr := range r.Answer {
|
|
|
|
if cn, ok := rr.(*dns.CNAME); ok {
|
|
|
|
if cn.Hdr.Name == fqdn {
|
|
|
|
return cn.Target
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return fqdn
|
|
|
|
}
|