Documentation
¶
Index ¶
Constants ¶
View Source
const ( A = QType("dns") SRV = QType("dnssrv") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
Provider is a stateful cache for asynchronous DNS resolutions. It provides a way to resolve addresses and obtain them.
func NewProvider ¶
func NewProvider(logger log.Logger, reg *extprom.SubsystemRegisterer) *Provider
NewProvider returns a new empty provider with a default resolver.
type Resolver ¶
type Resolver interface {
// Resolve performs a DNS lookup and returns a list of records.
// name is the domain name to be resolved.
// qtype is the query type. Accepted values are `dns` for A/AAAA lookup and `dnssrv` for SRV lookup.
// If qtype is `dns`, the domain name to be resolved requires a port or an error will be returned.
// If scheme is passed through name, it is preserved on IP results.
Resolve(ctx context.Context, name string, qtype QType) ([]string, error)
}
func NewResolver ¶
func NewResolver() Resolver
NewResolver provides a resolver with a specific net.Resolver. If resolver is nil, the default resolver will be used.
Click to show internal directories.
Click to hide internal directories.