dnsdummy

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDummyDNSPort = "5353"

DefaultDummyDNSPort is the port the dummy DNS server listens on (high port to avoid CAP_NET_BIND_SERVICE). Traffic to port 53 is DNAT'd to this port in the namespace.

View Source
const DummyA = "6.6.6.6"

DummyA is the IPv4 address returned for every A record query (arbitrary non-loopback).

View Source
const DummyAAAA = "2001:db8::1"

DummyAAAA is the IPv6 address returned for every AAAA record query (documentation prefix).

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server is a minimal DNS server that responds to every query with a dummy A record. Used inside the network namespace to prevent DNS exfiltration.

func NewServer

func NewServer(addr string, logger *slog.Logger) *Server

NewServer creates a dummy DNS server that listens on addr (e.g. "127.0.0.1:53").

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

ListenAndServe starts the UDP and TCP servers in goroutines and returns immediately. Logger must be non-nil; server errors are logged via s.logger.

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown stops the servers.

Jump to

Keyboard shortcuts

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