File: cname.go

package info (click to toggle)
golang-github-xenolf-lego 4.9.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,076 kB
  • sloc: xml: 533; makefile: 130; sh: 18
file content (16 lines) | stat: -rw-r--r-- 286 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
}