feat: custom response format

This commit is contained in:
Karan Sharma 2020-12-12 16:27:13 +05:30
parent 0aa3b36b35
commit a7268f578f
7 changed files with 78 additions and 33 deletions

View file

@ -1,10 +1,23 @@
package resolvers
import "github.com/miekg/dns"
import (
"time"
"github.com/miekg/dns"
)
// Resolver implements the configuration for a DNS
// Client. Different types of client like (UDP/TCP/DOH/DOT)
// can be initialised.
type Resolver interface {
Lookup([]dns.Question) error
Lookup([]dns.Question) ([]Response, error)
}
// Response represents a custom output format
// which wraps certain metadata about the DNS query
// and the DNS Answer as well.
type Response struct {
Message dns.Msg
RTT time.Duration
Nameserver string
}