1
0
mirror of https://github.com/go-acme/lego.git synced 2024-12-15 14:27:53 +02:00
lego/challenge/dns01/cname.go
2019-03-11 17:56:48 +01:00

17 lines
285 B
Go

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
}