Documentation ¶
Overview ¶
Package dns defines interfaces used by maddy modules to perform DNS lookups.
Currently, there is only Resolver interface which is implemented by dns.DefaultResolver(). In the future, DNSSEC-enabled stub resolver implementation will be added here.
Index ¶
- func Equal(domain1, domain2 string) bool
- func FQDN(domain string) string
- func ForLookup(domain string) (string, error)
- func IsNotFound(err error) bool
- func LookupAddr(ctx context.Context, r Resolver, ip net.IP) (string, error)
- func SelectIDNA(ulabel bool, domain string) (string, error)
- type ExtResolver
- func (e ExtResolver) AuthLookupAddr(ctx context.Context, addr string) (ad bool, names []string, err error)
- func (e ExtResolver) AuthLookupCNAME(ctx context.Context, host string) (ad bool, cname string, err error)
- func (e ExtResolver) AuthLookupHost(ctx context.Context, host string) (ad bool, addrs []string, err error)
- func (e ExtResolver) AuthLookupIPAddr(ctx context.Context, host string) (ad bool, addrs []net.IPAddr, err error)
- func (e ExtResolver) AuthLookupMX(ctx context.Context, name string) (ad bool, mxs []*net.MX, err error)
- func (e ExtResolver) AuthLookupTLSA(ctx context.Context, service, network, domain string) (ad bool, recs []TLSA, err error)
- func (e ExtResolver) AuthLookupTXT(ctx context.Context, name string) (ad bool, recs []string, err error)
- func (e ExtResolver) CheckCNAMEAD(ctx context.Context, host string) (ad bool, rname string, err error)
- type RCodeError
- type Resolver
- type TLSA
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equal ¶
Equal reports whether domain1 and domain2 are equivalent as defined by IDNA2008 (RFC 5890).
TL;DR Use this instead of strings.EqualFold to compare domains.
Equivalence for malformed A-label domains is defined using regular byte-string comparison with case-folding applied.
func ForLookup ¶
ForLookup converts the domain into a canonical form suitable for table lookups and other comparisons.
TL;DR Use this instead of strings.ToLower to prepare domain for lookups.
Domains that contain invalid UTF-8 or invalid A-label domains are simply converted to local-case using strings.ToLower, but the error is also returned.
func IsNotFound ¶
func LookupAddr ¶
LookupAddr is a convenience wrapper for Resolver.LookupAddr.
It returns the first name with trailing dot stripped.
Types ¶
type ExtResolver ¶
type ExtResolver struct { Cfg *dns.ClientConfig // contains filtered or unexported fields }
ExtResolver is a convenience wrapper for miekg/dns library that provides access to certain low-level functionality (notably, AD flag in responses, indicating whether DNSSEC verification was performed by the server).
func NewExtResolver ¶
func NewExtResolver() (*ExtResolver, error)
func (ExtResolver) AuthLookupAddr ¶
func (ExtResolver) AuthLookupCNAME ¶ added in v0.4.3
func (ExtResolver) AuthLookupHost ¶
func (ExtResolver) AuthLookupIPAddr ¶
func (ExtResolver) AuthLookupMX ¶
func (ExtResolver) AuthLookupTLSA ¶
func (ExtResolver) AuthLookupTXT ¶
func (ExtResolver) CheckCNAMEAD ¶ added in v0.4.3
func (e ExtResolver) CheckCNAMEAD(ctx context.Context, host string) (ad bool, rname string, err error)
CheckCNAMEAD is a special function for use in DANE lookups. It attempts to determine final (canonical) name of the host and also reports whether the whole chain of CNAME's and final zone are "secure".
If there are no A or AAAA records for host, rname = "" is returned.
type RCodeError ¶
RCodeError is returned by ExtResolver when the RCODE in response is not NOERROR.
func (RCodeError) Error ¶
func (err RCodeError) Error() string
func (RCodeError) Temporary ¶
func (err RCodeError) Temporary() bool
type Resolver ¶
type Resolver interface { LookupAddr(ctx context.Context, addr string) (names []string, err error) LookupHost(ctx context.Context, host string) (addrs []string, err error) LookupMX(ctx context.Context, name string) ([]*net.MX, error) LookupTXT(ctx context.Context, name string) ([]string, error) LookupIPAddr(ctx context.Context, host string) ([]net.IPAddr, error) }
Resolver is an interface that describes DNS-related methods used by maddy.
It is implemented by dns.DefaultResolver(). Methods behave the same way.
func DefaultResolver ¶
func DefaultResolver() Resolver