A validating, recursive, caching DNS resolver designed to be fast and lean, with DNSSEC validation built in.
miekg/dns
A Go library for building DNS clients and servers, covering all resource record types including DNSSEC.
- Stars
- 8,807
- Forks
- 1,223
- Open issues
- 3
- Last commit
- 5 days ago
What is it?
miekg/dns is a DNS library written in Go for programmers who need to work with DNS at the protocol level. It supports all resource record types, including the DNSSEC types, and can be used to build both servers and resolvers. The API is intentionally small: it provides the building blocks rather than many convenience functions.
The library covers UDP and TCP queries over IPv4 and IPv6, zone file parsing, and server-side programming modeled on the net/http package. On the security side it handles DNSSEC signing, validation and key generation for DSA, RSA, ECDSA and Ed25519, along with TSIG, SIG(0) and DNS over TLS. It also implements AXFR/IXFR zone transfers and EDNS0 options such as NSID, Cookies and Client Subnet.
The project notes that its successor, DNS version 2, is hosted on Codeberg and that this repository will only receive specific fixes before being archived.
Key features
- 01Supports all DNS resource record types, including DNSSEC types
- 02Builds both DNS servers and client-side resolvers
- 03DNSSEC signing, validation and key generation for several algorithms
- 04Zone file parsing with $INCLUDE, $ORIGIN, $TTL and $GENERATE
- 05AXFR/IXFR zone transfers and TSIG/SIG(0) authentication
- 06DNS over TLS and EDNS0 options such as NSID and Cookies
Use cases
- Writing a custom authoritative DNS server in Go
- Building a DNS resolver or forwarder with fine-grained control over queries
- Implementing DNSSEC signing or validation in a Go application
- Creating diagnostic tools that send raw DNS queries and inspect responses
Quick start
- 1
Install the library with the Go tool
go get github.com/miekg/dns - 2
Read the API overview at the start of doc.go or run godoc for the package
Things to know
- Development has moved to DNS version 2 at codeberg.org/miekg/dns, and this repository only receives specific fixes.
- This repository will be archived at some point.
Topics
FAQ
- What is dns?
- A Go library for building DNS clients and servers, covering all resource record types including DNSSEC. miekg/dns is a DNS library written in Go for programmers who need to work with DNS at the protocol level. It supports all resource record types, including the DNSSEC types, and can be used to build both servers and resolvers. The API is intentionally small: it provides the building blocks rather than many convenience functions.
- Is dns free to use? What license does it have?
- dns is open source under the BSD-3-Clause license. Check the license terms before using it in commercial products.
- Is dns still maintained?
- Actively maintained. The last commit to dns was on Nov 3, 2026.
- What can I use dns for?
- Writing a custom authoritative DNS server in Go Building a DNS resolver or forwarder with fine-grained control over queries Implementing DNSSEC signing or validation in a Go application Creating diagnostic tools that send raw DNS queries and inspect responses
- How do I install dns?
- Install the library with the Go tool: go get github.com/miekg/dns Read the API overview at the start of doc.go or run godoc for the package
- Where can I get dns?
- The source code and installation instructions are on GitHub: https://github.com/miekg/dns
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A flexible DNS server written in Go that chains plugins, each performing one DNS function.
An asynchronous, event-driven Java framework for building maintainable, high-performance network protocol servers and clients.
Open source authoritative and recursive DNS server with a web console, ad and malware blocking, and encrypted DNS support.
A portable DNS resolver in Rust that blocks ads, names local dev services as .numa domains, and can seal queries with ODoH.
A pure-Python implementation of the SSHv2 protocol, providing both client and server functionality for Python programs.