querylog

package
v0.0.0-...-b6e3791 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package querylog defines the AdGuard DNS query log constants and types and provides implementations of the log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Empty

type Empty struct{}

Empty is a query log does nothing and returns nil values.

func (Empty) Write

func (Empty) Write(_ context.Context, _ *Entry) (err error)

Write implements the Interface interface for Empty. It does nothing and returns nil.

type Entry

type Entry struct {
	// RemoteIP is the remote IP address of the client.
	RemoteIP netip.Addr

	// RequestResult is the result of filtering the DNS request.
	RequestResult filter.Result

	// ResponseResult is the result of filtering the DNS response.
	ResponseResult filter.Result

	// Time is the time of receiving the request.
	Time time.Time

	// ProfileID is the detected profile ID, if any.
	ProfileID agd.ProfileID

	// DeviceID is the detected device ID, if any.
	DeviceID agd.DeviceID

	// ClientCountry is the detected country of the client's IP address, if any.
	ClientCountry geoip.Country

	// ResponseCountry is the detected country of the first IP in the response
	// sent to the client, if any.
	ResponseCountry geoip.Country

	// DomainFQDN is the fully-qualified name of the requested resource.
	DomainFQDN string

	// RequestID is the ID of the request.
	RequestID agd.RequestID

	// ClientASN is the detected autonomous system number of the client's IP
	// address, if any.
	ClientASN geoip.ASN

	// Elapsed is the time passed since the beginning of the request processing
	// in milliseconds.
	Elapsed uint16

	// RequestType is the type of the resource record of the query.
	RequestType dnsmsg.RRType

	// Protocol is the DNS protocol used.
	Protocol agd.Protocol

	// DNSSEC is set to true if the response was validated with DNSSEC.
	DNSSEC bool

	// ResponseCode is the response code sent to the client.
	ResponseCode dnsmsg.RCode
}

Entry is a single query log entry.

type FileSystem

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

FileSystem is the file system implementation of the AdGuard DNS query log.

func NewFileSystem

func NewFileSystem(c *FileSystemConfig) (l *FileSystem)

NewFileSystem creates a new file system query log. The log is safe for concurrent use.

func (*FileSystem) Write

func (l *FileSystem) Write(_ context.Context, e *Entry) (err error)

Write implements the Interface interface for *FileSystem.

type FileSystemConfig

type FileSystemConfig struct {
	// Path is the path to the log file.
	Path string
}

FileSystemConfig is the configuration of the file system query log.

type Interface

type Interface interface {
	// Write writes the entry into the query log.  e must not be nil.
	Write(ctx context.Context, e *Entry) (err error)
}

Interface is the query log interface. All methods must be safe for concurrent use.

Jump to

Keyboard shortcuts

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