2019-03-11 16:56:48 +00:00
|
|
|
package dns01
|
2019-02-09 04:02:58 +00:00
|
|
|
|
2023-07-19 10:45:10 +00:00
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/miekg/dns"
|
|
|
|
)
|
2019-02-09 04:02:58 +00:00
|
|
|
|
2020-05-08 17:35:25 +00:00
|
|
|
// Update FQDN with CNAME if any.
|
2019-02-09 04:02:58 +00:00
|
|
|
func updateDomainWithCName(r *dns.Msg, fqdn string) string {
|
|
|
|
for _, rr := range r.Answer {
|
|
|
|
if cn, ok := rr.(*dns.CNAME); ok {
|
2023-07-19 10:45:10 +00:00
|
|
|
if strings.EqualFold(cn.Hdr.Name, fqdn) {
|
2019-02-09 04:02:58 +00:00
|
|
|
return cn.Target
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return fqdn
|
|
|
|
}
|