2020-12-11 12:18:54 +01:00
|
|
|
package resolvers
|
|
|
|
|
2020-12-12 11:57:13 +01:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/miekg/dns"
|
|
|
|
)
|
2020-12-11 12:18:54 +01:00
|
|
|
|
2020-12-12 07:16:13 +01:00
|
|
|
// Resolver implements the configuration for a DNS
|
2020-12-15 18:39:10 +01:00
|
|
|
// Client. Different types of providers can load
|
|
|
|
// a DNS Resolver satisfying this interface.
|
2020-12-11 12:18:54 +01:00
|
|
|
type Resolver interface {
|
2020-12-12 11:57:13 +01:00
|
|
|
Lookup([]dns.Question) ([]Response, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Response represents a custom output format
|
2020-12-15 18:39:10 +01:00
|
|
|
// for DNS queries. It wraps metadata about the DNS query
|
2020-12-12 11:57:13 +01:00
|
|
|
// and the DNS Answer as well.
|
|
|
|
type Response struct {
|
|
|
|
Message dns.Msg
|
|
|
|
RTT time.Duration
|
|
|
|
Nameserver string
|
2020-12-11 12:18:54 +01:00
|
|
|
}
|