2021-08-29 21:51:24 +02:00
|
|
|
package model
|
|
|
|
|
2022-08-03 22:10:07 +02:00
|
|
|
//go:generate go run github.com/abice/go-enum -f=$GOFILE --marshal --names
|
2021-08-29 21:51:24 +02:00
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/miekg/dns"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
2021-09-09 22:57:05 +02:00
|
|
|
// ResponseType represents the type of the response ENUM(
|
|
|
|
// RESOLVED // the response was resolved by the external upstream resolver
|
|
|
|
// CACHED // the response was resolved from cache
|
|
|
|
// BLOCKED // the query was blocked
|
|
|
|
// CONDITIONAL // the query was resolved by the conditional upstream resolver
|
|
|
|
// CUSTOMDNS // the query was resolved by a custom rule
|
2022-01-04 15:40:09 +01:00
|
|
|
// HOSTSFILE // the query was resolved by looking up the hosts file
|
2022-04-01 08:58:09 +02:00
|
|
|
// FILTERED // the query was filtered by query type
|
2022-06-20 13:02:51 +02:00
|
|
|
// NOTFQDN // the query was filtered as it is not fqdn conform
|
2022-08-26 23:59:11 +02:00
|
|
|
// SPECIAL // the query was resolved by the special use domain name resolver
|
2021-09-09 22:57:05 +02:00
|
|
|
// )
|
2021-08-29 21:51:24 +02:00
|
|
|
type ResponseType int
|
|
|
|
|
|
|
|
// Response represents the response of a DNS query
|
|
|
|
type Response struct {
|
|
|
|
Res *dns.Msg
|
|
|
|
Reason string
|
|
|
|
RType ResponseType
|
|
|
|
}
|
|
|
|
|
2021-09-09 22:57:05 +02:00
|
|
|
// RequestProtocol represents the server protocol ENUM(
|
2022-04-22 22:12:35 +02:00
|
|
|
// TCP // is the TCP protocol
|
2021-10-13 22:47:14 +02:00
|
|
|
// UDP // is the UDP protocol
|
2021-09-09 22:57:05 +02:00
|
|
|
// )
|
2021-08-29 21:51:24 +02:00
|
|
|
type RequestProtocol uint8
|
|
|
|
|
|
|
|
// Request represents client's DNS request
|
|
|
|
type Request struct {
|
2021-10-13 22:47:14 +02:00
|
|
|
ClientIP net.IP
|
|
|
|
RequestClientID string
|
|
|
|
Protocol RequestProtocol
|
|
|
|
ClientNames []string
|
|
|
|
Req *dns.Msg
|
|
|
|
Log *logrus.Entry
|
|
|
|
RequestTS time.Time
|
2021-08-29 21:51:24 +02:00
|
|
|
}
|