| 248 | } |
| 249 | |
| 250 | func (e ExtResolver) AuthLookupCNAME(ctx context.Context, host string) (ad bool, cname string, err error) { |
| 251 | msg := new(dns.Msg) |
| 252 | msg.SetQuestion(dns.Fqdn(host), dns.TypeCNAME) |
| 253 | msg.SetEdns0(4096, false) |
| 254 | msg.AuthenticatedData = true |
| 255 | resp, err := e.exchange(ctx, msg) |
| 256 | if err != nil { |
| 257 | return false, "", err |
| 258 | } |
| 259 | |
| 260 | for _, r := range resp.Answer { |
| 261 | cnameR, ok := r.(*dns.CNAME) |
| 262 | if !ok { |
| 263 | continue |
| 264 | } |
| 265 | return resp.AuthenticatedData, cnameR.Target, nil |
| 266 | } |
| 267 | |
| 268 | return resp.AuthenticatedData, "", nil |
| 269 | } |
| 270 | |
| 271 | func (e ExtResolver) AuthLookupIPAddr(ctx context.Context, host string) (ad bool, addrs []net.IPAddr, err error) { |
| 272 | // First, query IPv6. |