mirror of
https://github.com/go-acme/lego.git
synced 2024-12-13 13:48:45 +02:00
3cd3024561
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
21 lines
320 B
Go
21 lines
320 B
Go
package dns01
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"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 strings.EqualFold(cn.Hdr.Name, fqdn) {
|
|
return cn.Target
|
|
}
|
|
}
|
|
}
|
|
|
|
return fqdn
|
|
}
|