Add CNAME chasing for TXT records

This commit is contained in:
Herman Slatman 2022-10-20 01:18:34 +02:00
parent 7b45968198
commit d25b8afe68
No known key found for this signature in database
GPG key ID: F4D8A44EA0A75A4F

View file

@ -72,7 +72,12 @@ func (c *client) Get(url string) (*http.Response, error) {
} }
func (c *client) LookupTxt(name string) ([]string, error) { func (c *client) LookupTxt(name string) ([]string, error) {
return net.LookupTXT(name) // chase CNAME records, if any
cname, err := net.LookupCNAME(name)
if err != nil {
return nil, err
}
return net.LookupTXT(cname)
} }
func (c *client) TLSDial(network, addr string, config *tls.Config) (*tls.Conn, error) { func (c *client) TLSDial(network, addr string, config *tls.Config) (*tls.Conn, error) {