35 lines
834 B
Go
35 lines
834 B
Go
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
package util
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/miekg/dns"
|
|
)
|
|
|
|
// Response is the DNS response.
|
|
type Response struct {
|
|
// The full DNS response
|
|
DNS *dns.Msg `json:"response"`
|
|
// The time it took to make the DNS query
|
|
RTT time.Duration `json:"rtt"`
|
|
}
|
|
|
|
// Request is a structure for a DNS query.
|
|
type Request struct {
|
|
// Server to query, eg. 8.8.8.8
|
|
Server string `json:"server"`
|
|
// Domain to query, eg. example.com
|
|
Name string `json:"name"`
|
|
// Duration to wait until marking request as failed
|
|
Timeout time.Duration `json:"timeout"`
|
|
// Port to make DNS request on
|
|
Port int `json:"port"`
|
|
// Number of failures to make before giving up
|
|
Retries int `json:"retries"`
|
|
// Request type, eg. A, AAAA, NAPTR
|
|
Type uint16 `json:"type"`
|
|
// Request class, eg. IN
|
|
Class uint16 `json:"class"`
|
|
}
|