edns

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const TCPKeepaliveTimeout = 8 * time.Second

TCPKeepaliveTimeout is the idle timeout this server advertises to stream clients that sent the RFC 7828 edns-tcp-keepalive option. It must state what the engine actually enforces — the server package's per-connection idle wait — and a test over there pins the two together, since neither package can import the other's constant.

Variables

This section is empty.

Functions

This section is empty.

Types

type EDNS

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

EDNS type.

func New

func New(cfg *config.Config) *EDNS

New return edns.

func (*EDNS) Name

func (e *EDNS) Name() string

(*EDNS).Name name return middleware name.

func (*EDNS) ServeDNS

func (e *EDNS) ServeDNS(ctx context.Context, ch *middleware.Chain)

(*EDNS).ServeDNS serveDNS implements the Handle interface. A wire-born request is served from its parsed OPT facts without decoding; cold protocol errors (foreign opcode, BADVERS) and message-born requests take the decoded body.

type ResponseWriter added in v0.2.5

type ResponseWriter struct {
	middleware.ResponseWriter
	*EDNS
	// contains filtered or unexported fields
}

ResponseWriter implement of ctx.ResponseWriter.

func (*ResponseWriter) AbortWire added in v1.8.0

func (w *ResponseWriter) AbortWire()

AbortWire releases the lease without a send.

func (*ResponseWriter) BeginWire added in v1.8.0

func (w *ResponseWriter) BeginWire(size, reserve int) []byte

BeginWire delegates the pre-build lease down the writer chain; edns has no buffer of its own — its OPT lands in the reserve the lease carries.

func (*ResponseWriter) CommitWire added in v1.8.0

func (w *ResponseWriter) CommitWire(body []byte, info middleware.WireInfo) error

CommitWire sends a leased body through this layer's WriteWire, so the per-client OPT is appended exactly as on the unleased wire path.

func (*ResponseWriter) Size added in v1.8.0

func (w *ResponseWriter) Size() int

Size forwards the response's wire length from the writer beneath. The wrapper embeds the narrow ResponseWriter interface, which deliberately does not carry Size, so without this an observer above this layer — the access log is one — would fall back to decoding the response just to measure it, which on the byte path is the whole cost this path avoids.

func (*ResponseWriter) WireReady added in v1.8.0

func (w *ResponseWriter) WireReady() (middleware.WireCapability, bool)

WireReady reports what the byte path may produce for this client. It allocates nothing: the OPT's contribution is arithmetic, so a request the caller ends up refusing has cost only field reads. The record itself is built once, later, in WriteWire.

It answers with the client's own DO bit, which the request no longer carries — SetEdns0 turns DO on so upstream validation happens regardless of what the client asked for, and only the writer remembers the original.

func (*ResponseWriter) WriteMsg added in v0.2.5

func (w *ResponseWriter) WriteMsg(m *dns.Msg) error

(*ResponseWriter).WriteMsg writeMsg implements the ctx.ResponseWriter interface.

func (*ResponseWriter) WriteWire added in v1.8.0

func (w *ResponseWriter) WriteWire(body []byte, info middleware.WireInfo) error

WriteWire appends the per-client OPT and forwards the bytes. The guards here are backstops: WireReady already settled DO, size, and chain support, so reaching a fallback means an assumption broke rather than an ordinary refusal.

Jump to

Keyboard shortcuts

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