1
0
mirror of https://github.com/go-acme/lego.git synced 2024-12-23 09:15:11 +02:00
lego/challenge/dns01/cname.go

21 lines
320 B
Go
Raw Normal View History

2019-03-11 18:56:48 +02:00
package dns01
import (
"strings"
"github.com/miekg/dns"
)
2020-05-08 19:35:25 +02:00
// 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 strings.EqualFold(cn.Hdr.Name, fqdn) {
return cn.Target
}
}
}
return fqdn
}