server

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package server aids writing DNS servers

Index

Constants

View Source
const (
	// DefaultLookupTimeout is the maximum time INET lookups
	// can take unless [Handler.Timeout] is specified
	DefaultLookupTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Hostname string
	Version  string
	Authors  string

	Context  context.Context
	Timeout  time.Duration
	Lookuper resolver.Lookuper
	Extra    map[uint16]dns.HandlerFunc

	RemoteAddr *core.ContextKey[netip.Addr]

	OnError func(dns.ResponseWriter, *dns.Msg, error)
}

Handler provides a dns.Handler for dns.ServeMux

func (*Handler) ServeDNS

func (h *Handler) ServeDNS(w dns.ResponseWriter, r *dns.Msg)

ServeDNS handles requests passed by dns.ServeMUX

func (*Handler) SetDefaults

func (h *Handler) SetDefaults()

SetDefaults fills gaps in the Handler struct

Jump to

Keyboard shortcuts

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