Documentation
¶
Overview ¶
Package dnscheck contains types and utilities for checking if a particular client uses the DNS server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmptyMetrics ¶
type EmptyMetrics struct{}
EmptyMetrics is the implementation of the Metrics interface that does nothing.
func (EmptyMetrics) HandleError ¶
func (EmptyMetrics) HandleError(_ context.Context, _, _ string)
HandleError implements the Metrics interface for EmptyMetrics.
func (EmptyMetrics) HandleRequest ¶
func (EmptyMetrics) HandleRequest(_ context.Context, _ string, _ bool)
HandleRequest implements the Metrics interface for EmptyMetrics.
type Interface ¶
type Interface interface { // Check saves the information about a client's request and returns the // appropriate response. If req is not the right type of request or not // a request for the appropriate check domain, both resp and err are nil. // // All arguments must be non-nil. req must contain one question, which // should be either an A or an AAAA one. Check(ctx context.Context, req *dns.Msg, ri *agd.RequestInfo) (resp *dns.Msg, err error) }
Interface is the DNS checker interface. All methods must be safe for concurrent use.
type Metrics ¶
type Metrics interface { // HandleError handles the total number of errors by type. reqType must be // [reqMtrcTypeDNS] or [reqMtrcTypeHTTP]. errType must be either // [errMtrcTypeTimeout], [errMtrcTypeRatelimit], [errMtrcTypeOther] or an // empty string. HandleError(ctx context.Context, reqType, errType string) // HandleRequest handles the total number of requests by type. reqType must // be [reqMtrcTypeDNS] or [reqMtrcTypeHTTP]. HandleRequest(ctx context.Context, reqType string, isValid bool) }
Metrics is an interface that is used for the collection of the DNSCheck service statistics.
type RemoteKV ¶
type RemoteKV struct {
// contains filtered or unexported fields
}
RemoteKV is the RemoteKV KV based DNS checker.
func NewRemoteKV ¶
func NewRemoteKV(c *RemoteKVConfig) (dc *RemoteKV)
NewRemoteKV creates a new remote KV based DNS checker. c must be non-nil.
type RemoteKVConfig ¶
type RemoteKVConfig struct { // Logger is used to log the operation of the DNS checker. Logger *slog.Logger // Messages is the message constructor used to create DNS responses with // IPv4 and IPv6 IPs. Messages *dnsmsg.Constructor // Metrics is used for the collection of the DNSCheck service statistics. Metrics Metrics // RemoteKV for DNS server checking. RemoteKV remotekv.Interface // ErrColl is the error collector that is used to collect non-critical // errors. ErrColl errcoll.Interface // Domains are the lower-cased domain names used to detect DNS check requests. Domains []string // NodeLocation is the location of this server node. NodeLocation string // NodeName is the name of this server node. NodeName string // IPv4 are the IPv4 addresses to respond with to A requests. IPv4 []netip.Addr // IPv6 are the IPv6 addresses to respond with to AAAA requests. IPv6 []netip.Addr }
RemoteKVConfig is the configuration structure for remote KV based DNS checker. All fields must be non-empty.