dns

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package dns provides a minimal UDP DNS server that resolves a configured domain (and any subdomain of it) to 127.0.0.1.

It is intentionally dependency-free: DNS packets are parsed and constructed using only the standard library. The server does no recursion or forwarding — names that do not match the configured domain receive NXDOMAIN.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartDNSServer

func StartDNSServer(port int, domain string)

StartDNSServer starts a minimal UDP DNS server on the given port. Any A-record query for domain or *.domain is answered with 127.0.0.1. All other queries receive an NXDOMAIN response (no forwarding).

Typical usage (non-privileged port):

go dns.StartDNSServer(15353, "localhost.example.com")

Types

This section is empty.

Jump to

Keyboard shortcuts

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