dnsdb

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: 20 Imported by: 0

Documentation

Overview

Package dnsdb contains types and utilities for collecting anonymous statistics about the Internet.

TODO(a.garipov): This needs way more tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Default

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

Default is the default DNSDB implementation.

func New

func New(c *DefaultConfig) (db *Default)

New creates a new default DNS database. c must not be nil.

func (*Default) Record

func (db *Default) Record(ctx context.Context, m *dns.Msg, ri *agd.RequestInfo)

Record implements the Interface interface for *Default. It saves a DNS response to its in-memory buffer.

func (*Default) ServeHTTP

func (db *Default) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface for *Default.

type DefaultConfig

type DefaultConfig struct {
	// ErrColl is used to collect HTTP errors.
	ErrColl errcoll.Interface

	// MaxSize is the maximum amount of records in the memory buffer.
	MaxSize int
}

DefaultConfig is the default DNS database configuration structure.

type Empty

type Empty struct{}

Empty is a DNS query database that does nothing.

func (Empty) Record

func (Empty) Record(_ context.Context, _ *dns.Msg, _ *agd.RequestInfo)

Record implements the Interface interface for Empty.

type Interface

type Interface interface {
	// Record saves anonymous data from the DNS query.
	Record(ctx context.Context, resp *dns.Msg, ri *agd.RequestInfo)
}

Interface is the DNS query database interface.

Jump to

Keyboard shortcuts

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