Documentation
¶
Index ¶
Constants ¶
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.
func (*Provider) Addresses ¶
Addresses returns the latest addresses present in the Provider.
func (*Provider) Resolve ¶
Resolve stores a list of provided addresses or their DNS records if requested. Addresses prefixed with `dns+` or `dnssrv+` will be resolved through respective DNS lookup (A/AAAA or SRV). defaultPort is used for non-SRV records when a port is not supplied.
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)
}
Source Files
¶
- provider.go
- resolver.go
Click to show internal directories.
Click to hide internal directories.