| 345 | } |
| 346 | |
| 347 | func (e ExtResolver) AuthLookupTLSA(ctx context.Context, service, network, domain string) (ad bool, recs []TLSA, err error) { |
| 348 | name, err := dns.TLSAName(domain, service, network) |
| 349 | if err != nil { |
| 350 | return false, nil, err |
| 351 | } |
| 352 | |
| 353 | msg := new(dns.Msg) |
| 354 | msg.SetQuestion(dns.Fqdn(name), dns.TypeTLSA) |
| 355 | msg.SetEdns0(4096, false) |
| 356 | msg.AuthenticatedData = true |
| 357 | |
| 358 | resp, err := e.exchange(ctx, msg) |
| 359 | if err != nil { |
| 360 | return false, nil, err |
| 361 | } |
| 362 | |
| 363 | ad = resp.AuthenticatedData |
| 364 | recs = make([]dns.TLSA, 0, len(resp.Answer)) |
| 365 | for _, rr := range resp.Answer { |
| 366 | rr, ok := rr.(*dns.TLSA) |
| 367 | if !ok { |
| 368 | continue |
| 369 | } |
| 370 | |
| 371 | recs = append(recs, *rr) |
| 372 | } |
| 373 | return |
| 374 | } |
| 375 | |
| 376 | func NewExtResolver() (*ExtResolver, error) { |
| 377 | cfg, err := dns.ClientConfigFromFile("/etc/resolv.conf") |