{"modulePath":"github.com/foxcpp/maddy","version":"v0.9.8","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package dns\n\nPackage dns defines interfaces used by maddy modules to perform DNS lookups.\n\nCurrently, there is only Resolver interface which is implemented by dns.DefaultResolver(). In the future, DNSSEC-enabled stub resolver implementation will be added here.\n\n## Constants\n\n```go\nconst DefaultConfigPath = \"/etc/resolv.conf\"\n```\n\n## Functions\n\n```go\nfunc Equal(domain1, domain2 string) bool\n```\nEqual reports whether domain1 and domain2 are equivalent as defined by IDNA2008 (RFC 5890).\n\nTL;DR Use this instead of strings.EqualFold to compare domains.\n\nEquivalence for malformed A-label domains is defined using regular byte-string comparison with case-folding applied.\n\n```go\nfunc FQDN(domain string) string\n```\n\n```go\nfunc ForLookup(domain string) (string, error)\n```\nForLookup converts the domain into a canonical form suitable for table lookups and other comparisons.\n\nTL;DR Use this instead of strings.ToLower to prepare domain for lookups.\n\nDomains 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.\n\n```go\nfunc ForLookupASCII(domain string) (string, error)\n```\nForLookupASCII converts the domain into a canonical form suitable for table lookups and other comparisons.\n\nAs compared to ForLookup (returning U-labels), this function returns A-labels representation.\n\n```go\nfunc IsNotFound(err error) bool\n```\n\n```go\nfunc LookupAddr(ctx context.Context, r Resolver, ip net.IP) (string, error)\n```\nLookupAddr is a convenience wrapper for Resolver.LookupAddr.\n\nIt returns the first name with trailing dot stripped.\n\n```go\nfunc SelectIDNA(ulabel bool, domain string) (string, error)\n```\nSelectIDNA is a convenience function for encoding to/from Punycode.\n\nIf ulabel is true, it returns U-label encoded domain in the Unicode NFC form. If ulabel is false, it returns A-label encoded domain.\n\n## Types\n\n```go\ntype ClientConfig = dns.ClientConfig\n```\nClientConfig is the DNS client configuration accepted by NewFromConfig.\n\n```go\ntype ExtResolver struct {\n\t// contains filtered or unexported fields\n}\n```\nExtResolver 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).\n\n```go\nfunc NewExtResolver(opts ...Option) (*ExtResolver, error)\n```\nNewExtResolver constructs a resolver using the system configuration.\n\n```go\nfunc NewFromConfig(cfg *ClientConfig, opts ...Option) (*ExtResolver, error)\n```\nNewFromConfig constructs a resolver with a fixed configuration. It ignores system override.\n\n```go\nfunc NewFromConfigFile(confPath string, opts ...Option) (*ExtResolver, error)\n```\nNewFromConfigFile constructs a resolver that checks the file for changes.\n\n```go\nfunc (e *ExtResolver) AuthLookupAddr(ctx context.Context, addr string) (ad bool, names []string, err error)\n```\n\n```go\nfunc (e *ExtResolver) AuthLookupCNAME(ctx context.Context, host string) (ad bool, cname string, err error)\n```\n\n```go\nfunc (e *ExtResolver) AuthLookupHost(ctx context.Context, host string) (ad bool, addrs []string, err error)\n```\n\n```go\nfunc (e *ExtResolver) AuthLookupIPAddr(ctx context.Context, host string) (ad bool, addrs []net.IPAddr, err error)\n```\n\n```go\nfunc (e *ExtResolver) AuthLookupMX(ctx context.Context, name string) (ad bool, mxs []*net.MX, err error)\n```\n\n```go\nfunc (e *ExtResolver) AuthLookupTLSA(ctx context.Context, service, network, domain string) (ad bool, recs []TLSA, err error)\n```\n\n```go\nfunc (e *ExtResolver) AuthLookupTXT(ctx context.Context, name string) (ad bool, recs []string, err error)\n```\n\n```go\nfunc (e *ExtResolver) CheckCNAMEAD(ctx context.Context, host string) (ad bool, rname string, err error)\n```\nCheckCNAMEAD 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\".\n\nIf there are no A or AAAA records for host, rname = \"\" is returned.\n\n```go\ntype Option = func(*ExtResolver)\n```\nOption customizes an ExtResolver during construction.\n\n```go\nfunc WithLogger(logger *log.Logger) Option\n```\nWithLogger sets the logger used by the resolver.\n\n```go\ntype RCodeError struct {\n\tName string\n\tCode int\n}\n```\nRCodeError is returned by ExtResolver when the RCODE in response is not NOERROR.\n\n```go\nfunc (err RCodeError) Error() string\n```\n\n```go\nfunc (err RCodeError) Temporary() bool\n```\n\n```go\ntype Resolver interface {\n\tLookupAddr(ctx context.Context, addr string) (names []string, err error)\n\tLookupHost(ctx context.Context, host string) (addrs []string, err error)\n\tLookupMX(ctx context.Context, name string) ([]*net.MX, error)\n\tLookupTXT(ctx context.Context, name string) ([]string, error)\n\tLookupIPAddr(ctx context.Context, host string) ([]net.IPAddr, error)\n}\n```\nResolver is an interface that describes DNS-related methods used by maddy.\n\nIt is implemented by dns.DefaultResolver(). Methods behave the same way.\n\n```go\nfunc DefaultResolver() Resolver\n```\n\n```go\ntype TLSA = dns.TLSA\n```\n\n","path":"github.com/foxcpp/maddy/framework/dns","name":"dns","synopsis":"Package dns defines interfaces used by maddy modules to perform DNS lookups.","isRedistributable":true}
