dnscheck

package
v0.0.0-...-87137bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

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 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 RemoteKV

type RemoteKV struct {
	// contains filtered or unexported fields
}

RemoteKV is the RemoteKV KV based DNS checker.

func NewRemoteKV

func NewRemoteKV(c *RemoteKVConfig) (cc *RemoteKV)

NewRemoteKV creates a new remote KV based DNS checker. c must be non-nil.

func (*RemoteKV) Check

func (cc *RemoteKV) Check(
	ctx context.Context,
	req *dns.Msg,
	ri *agd.RequestInfo,
) (resp *dns.Msg, err error)

Check implements the Interface interface for *RemoteKV.

func (*RemoteKV) ServeHTTP

func (cc *RemoteKV) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface for *RemoteKV.

type RemoteKVConfig

type RemoteKVConfig struct {
	// Messages is the message constructor used to create DNS responses with
	// IPv4 and IPv6 IPs.
	Messages *dnsmsg.Constructor

	// 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL