Documentation ¶
Index ¶
- func MockTimeoutError() *net.OpError
- func ProblemDetailsFromDNSError(err error) *probs.ProblemDetails
- type DNSError
- type DNSResolver
- type DNSResolverImpl
- func (dnsResolver *DNSResolverImpl) LookupCAA(ctx context.Context, hostname string) ([]*dns.CAA, error)
- func (dnsResolver *DNSResolverImpl) LookupHost(ctx context.Context, hostname string) ([]net.IP, error)
- func (dnsResolver *DNSResolverImpl) LookupMX(ctx context.Context, hostname string) ([]string, error)
- func (dnsResolver *DNSResolverImpl) LookupTXT(ctx context.Context, hostname string) ([]string, []string, error)
- type MockDNSResolver
- func (mock *MockDNSResolver) LookupCAA(_ context.Context, domain string) ([]*dns.CAA, error)
- func (mock *MockDNSResolver) LookupHost(_ context.Context, hostname string) ([]net.IP, error)
- func (mock *MockDNSResolver) LookupMX(_ context.Context, domain string) ([]string, error)
- func (mock *MockDNSResolver) LookupTXT(_ context.Context, hostname string) ([]string, []string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockTimeoutError ¶
MockTimeoutError returns a a net.OpError for which Timeout() returns true.
func ProblemDetailsFromDNSError ¶
func ProblemDetailsFromDNSError(err error) *probs.ProblemDetails
ProblemDetailsFromDNSError checks the error returned from Lookup... methods and tests if the error was an underlying net.OpError or an error caused by resolver returning SERVFAIL or other invalid Rcodes and returns the relevant core.ProblemDetails. The detail string will contain a mention of the DNS record type and domain given.
Types ¶
type DNSError ¶
type DNSError struct {
// contains filtered or unexported fields
}
DNSError wraps a DNS error with various relevant information
type DNSResolver ¶
type DNSResolver interface { LookupTXT(context.Context, string) (txts []string, authorities []string, err error) LookupHost(context.Context, string) ([]net.IP, error) LookupCAA(context.Context, string) ([]*dns.CAA, error) LookupMX(context.Context, string) ([]string, error) }
DNSResolver queries for DNS records
type DNSResolverImpl ¶
type DNSResolverImpl struct { LookupIPv6 bool // contains filtered or unexported fields }
DNSResolverImpl represents a client that talks to an external resolver
func NewDNSResolverImpl ¶
func NewDNSResolverImpl(readTimeout time.Duration, servers []string, stats metrics.Scope, clk clock.Clock, maxTries int) *DNSResolverImpl
NewDNSResolverImpl constructs a new DNS resolver object that utilizes the provided list of DNS servers for resolution.
func NewTestDNSResolverImpl ¶
func NewTestDNSResolverImpl(readTimeout time.Duration, servers []string, stats metrics.Scope, clk clock.Clock, maxTries int) *DNSResolverImpl
NewTestDNSResolverImpl constructs a new DNS resolver object that utilizes the provided list of DNS servers for resolution and will allow loopback addresses. This constructor should *only* be called from tests (unit or integration).
func (*DNSResolverImpl) LookupCAA ¶
func (dnsResolver *DNSResolverImpl) LookupCAA(ctx context.Context, hostname string) ([]*dns.CAA, error)
LookupCAA sends a DNS query to find all CAA records associated with the provided hostname. If the response code from the resolver is SERVFAIL an empty slice of CAA records is returned.
func (*DNSResolverImpl) LookupHost ¶
func (dnsResolver *DNSResolverImpl) LookupHost(ctx context.Context, hostname string) ([]net.IP, error)
LookupHost sends a DNS query to find all A and AAAA records associated with the provided hostname. This method assumes that the external resolver will chase CNAME/DNAME aliases and return relevant records. It will retry requests in the case of temporary network errors. It can return net package, context.Canceled, and context.DeadlineExceeded errors, all wrapped in the DNSError type.
func (*DNSResolverImpl) LookupMX ¶
func (dnsResolver *DNSResolverImpl) LookupMX(ctx context.Context, hostname string) ([]string, error)
LookupMX sends a DNS query to find a MX record associated hostname and returns the record target.
func (*DNSResolverImpl) LookupTXT ¶
func (dnsResolver *DNSResolverImpl) LookupTXT(ctx context.Context, hostname string) ([]string, []string, error)
LookupTXT sends a DNS query to find all TXT records associated with the provided hostname which it returns along with the returned DNS authority section.
type MockDNSResolver ¶
type MockDNSResolver struct { }
MockDNSResolver is a mock
func (*MockDNSResolver) LookupHost ¶
LookupHost is a mock
Note: see comments on LookupMX regarding email.only