dispatch/vendor/github.com/go-acme/lego/v3/challenge/dns01/cname.go

17 lines
285 B
Go
Raw Normal View History

2019-06-09 00:01:48 +00:00
package dns01
import "github.com/miekg/dns"
// Update FQDN with CNAME if any
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
}