mirror of https://github.com/0xERR0R/blocky.git
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package model
|
|
|
|
//go:generate go-enum -f=$GOFILE --marshal --names
|
|
import (
|
|
"net"
|
|
"time"
|
|
|
|
"github.com/miekg/dns"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// 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
|
|
// HOSTSFILE // the query was resolved by looking up the hosts file
|
|
// FILTERED // the query was filtered by query type
|
|
// )
|
|
type ResponseType int
|
|
|
|
// Response represents the response of a DNS query
|
|
type Response struct {
|
|
Res *dns.Msg
|
|
Reason string
|
|
RType ResponseType
|
|
}
|
|
|
|
// RequestProtocol represents the server protocol ENUM(
|
|
// TCP // is the TCP protocol
|
|
// UDP // is the UDP protocol
|
|
// )
|
|
type RequestProtocol uint8
|
|
|
|
// Request represents client's DNS request
|
|
type Request struct {
|
|
ClientIP net.IP
|
|
RequestClientID string
|
|
Protocol RequestProtocol
|
|
ClientNames []string
|
|
Req *dns.Msg
|
|
Log *logrus.Entry
|
|
RequestTS time.Time
|
|
}
|