dns

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(addr string, opts ...Option) error

ListenAndServe starts a DNS server on addr (UDP and TCP) with the given options and blocks until a listener fails.

func ServePacket

func ServePacket(pc net.PacketConn, opts ...Option) error

ServePacket constructs and serves DNS over pc in one call. Prefer NewPacketServer + Serve when the serve loop runs in a goroutine, so construction errors surface synchronously.

Types

type Option

type Option func(*options)

Option configures the DNS server.

func WithBlockNonGlobalIPs

func WithBlockNonGlobalIPs() Option

WithBlockNonGlobalIPs blocks responses containing non-global unicast IPs.

func WithPlugins

func WithPlugins(p ...plugin.Plugin) Option

WithPlugins adds DNS plugins to the server chain.

type PacketServer

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

PacketServer is a constructed DNS server ready to serve over a packet conn. Construction (which loads resolv.conf for the upstream plugin) is separated from serving so a caller that runs the serve loop in a goroutine can still surface construction errors synchronously — a silently-failed server would bind a socket that never answers, stalling every query to timeout.

func NewPacketServer

func NewPacketServer(opts ...Option) (*PacketServer, error)

NewPacketServer constructs a DNS server for serving over a packet conn (UDP semantics only — no TCP twin), returning any construction error (e.g. resolv.conf load failure) synchronously. Call Serve to run it.

func (*PacketServer) Serve

func (p *PacketServer) Serve(pc net.PacketConn) error

Serve serves DNS over pc and blocks until pc fails or is closed. The caller owns pc's lifecycle: closing it is the shutdown path, after which Serve returns the resulting read error.

Directories

Path Synopsis
Package vpcdns is the serving core of the Apoxy VPC name plane: a CoreDNS plugin that answers, authoritatively, for names bound into a project's VPC (tunnel endpoints today, VPC-bound Services later) and passes everything else to the next plugin in the chain (typically cache -> upstream).
Package vpcdns is the serving core of the Apoxy VPC name plane: a CoreDNS plugin that answers, authoritatively, for names bound into a project's VPC (tunnel endpoints today, VPC-bound Services later) and passes everything else to the next plugin in the chain (typically cache -> upstream).

Jump to

Keyboard shortcuts

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