explaingit

miekg/dns

8,677GoAudience · developerComplexity · 3/5Setup · easy

TLDR

A full-featured Go library for building DNS clients, servers, and tools at a low level, supporting DNSSEC, DNS over TLS, zone file parsing, zone transfers, and decades of DNS RFCs in a single package.

Mindmap

mindmap
  root((miekg dns))
    Core Capabilities
      DNS client lookups
      DNS server responses
      Low-level control
    Security Features
      DNSSEC signing
      DNSSEC validation
      DNS over TLS
    Advanced DNS
      Zone file parsing
      Zone transfers
      Dynamic updates
    Ecosystem
      CoreDNS foundation
      HashiCorp Consul
      Go module install
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a custom DNS resolver or authoritative DNS server in Go using this low-level toolkit as the foundation.

USE CASE 2

Add DNSSEC signature generation and verification to a Go application that handles or validates DNS queries.

USE CASE 3

Parse DNS zone files, implement dynamic DNS updates, or set up zone transfers between DNS servers in Go.

Tech stack

Go

Getting it running

Difficulty · easy Time to first run · 30min

This repository is in maintenance mode, a faster version 2 is available on Codeberg. Install via the standard Go module system.

In plain English

DNS is the system that translates a web address like "example.com" into the numerical address a computer actually uses to connect. This Go library gives programmers a complete toolkit for working with DNS at a low level, both from the client side (looking things up) and from the server side (answering requests). It is deliberately small: the authors follow a philosophy of not providing convenience wrappers for things that are straightforward to write yourself in Go. The library supports all standard DNS record types, including the security extensions known as DNSSEC, which let DNS responses be cryptographically signed so receivers can verify they have not been tampered with. It handles key generation, signing, and validation for several common algorithms. It also supports encrypted DNS over TLS, which wraps the usual DNS traffic in an encrypted channel so the query contents cannot be read in transit. Beyond basic lookups, the library covers zone file parsing, dynamic updates, TSIG authentication (a way to sign DNS messages using a shared secret), and zone transfers, which are the mechanism servers use to replicate their data to backup servers. It tracks the DNS standards closely, with a long list of RFCs implemented covering decades of specifications. The library has been picked up by a wide range of projects, including CoreDNS (a widely used DNS server), HashiCorp Consul (a service networking tool), and many others across the DNS tooling ecosystem. It has been maintained since 2010 and remains actively used, though the authors note that a new version 2 is now available at a separate location on Codeberg and is roughly twice as fast. This repository is in maintenance mode, receiving fixes but no new features. If you need to build a DNS resolver, a custom DNS server, a security auditing tool, or anything else that speaks DNS natively, this library provides the foundation. It requires Go and installs through the standard Go module system.

Copy-paste prompts

Prompt 1
Using the miekg/dns Go library, write a simple DNS client that resolves a domain name and prints all A and AAAA records returned.
Prompt 2
Show me how to build a minimal authoritative DNS server in Go using miekg/dns that responds to A record queries from a hardcoded zone.
Prompt 3
Using miekg/dns, write Go code that validates a DNSSEC-signed DNS response and reports whether the signature is valid.
Prompt 4
How do I implement DNS over TLS in Go using the miekg/dns library to encrypt my DNS queries so they cannot be read in transit?
Open on GitHub → Explain another repo

← miekg on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.