github.com/thanos-io/thanos@v0.32.5/pkg/discovery/dns/godns/resolver.go (about)

     1  // Copyright (c) The Thanos Authors.
     2  // Licensed under the Apache License 2.0.
     3  
     4  package godns
     5  
     6  import (
     7  	"net"
     8  
     9  	"github.com/pkg/errors"
    10  )
    11  
    12  // Resolver is a wrapper for net.Resolver.
    13  type Resolver struct {
    14  	*net.Resolver
    15  }
    16  
    17  // IsNotFound checkout if DNS record is not found.
    18  func (r *Resolver) IsNotFound(err error) bool {
    19  	if err == nil {
    20  		return false
    21  	}
    22  	err = errors.Cause(err)
    23  	dnsErr, ok := err.(*net.DNSError)
    24  	return ok && dnsErr.IsNotFound
    25  }