1
0
Fork
You've already forked dns
0
forked from miekg/dns
Go DNS library
  • Go 91.5%
  • Roff 8.4%
2025年11月27日 17:09:08 +01:00
.woodpecker atomdns: fix windows build 2025年11月04日 21:54:36 +01:00
cmd typos 2025年11月26日 08:58:42 +01:00
deleg gen 2025年11月14日 17:08:03 +01:00
dnsconf
dnshttp dnshttp documentation 2025年11月13日 06:57:52 +01:00
dnstest
dnsutil Next/Prev are also much simpler 2025年11月14日 17:08:03 +01:00
internal back 2025年11月25日 18:37:45 +01:00
pool Fork pool.go off into own package: pool 2025年11月22日 08:03:34 +01:00
svcb gen 2025年11月14日 17:08:03 +01:00
testdata zonemd: sign root zone 2025年11月04日 17:38:28 +01:00
.changelog.go.tmpl
bench_test.go
CHANGELOG.md atomdns new version and regen changelog 2025年10月29日 10:46:49 +01:00
ci_test.go
client.go IPv{4,6}Family 2025年11月07日 09:47:05 +01:00
clone_generate.go
compare_generate.go dns: finish compare 2025年11月05日 14:22:51 +01:00
CONTRIBUTORS
COPYRIGHT
dane.go
dns.go smaller syntax for const 2025年11月25日 07:21:07 +01:00
dnssec.go faster 2025年11月24日 16:33:45 +01:00
dnssec_keygen.go
dnssec_keyscan.go
dnssec_privkey.go dns: receiver naming + docs 2025年11月03日 09:21:55 +01:00
dnssec_signer.go dns: only use one buffer for DNSSEC signatures gen/verify 2025年10月29日 10:20:41 +01:00
dnssec_test.go
dnstest_generate.go
dnsutil_generate.go dns: remove \DDD 2025年11月14日 17:08:03 +01:00
doc.go
dso_types.go dns: explain how to get tls ConnectionState from Conn() 2025年11月11日 07:19:09 +01:00
dsolen_generate.go dso: finish remaining types 2025年11月10日 06:57:44 +01:00
dsorr_generate.go
edns_types.go dso: finish remaining types 2025年11月10日 06:57:44 +01:00
ednsrr_generate.go
errors.go
generate.go
go.mod (chore): update deps 2025年11月27日 08:43:07 +01:00
go.sum chore: go mod tidy 2025年11月27日 09:03:14 +01:00
headerpack.go Remove t from Header 2025年11月24日 16:22:48 +01:00
len_generate.go dso: finish remaining types 2025年11月10日 06:57:44 +01:00
LICENSE
listen_no_socket_options.go
listen_socket_options.go
Makefile.release
msg.go dns: optimize more 2025年11月25日 16:42:21 +01:00
msg_generate.go dso: finish remaining types 2025年11月10日 06:57:44 +01:00
msg_test.go
nsecpack.go
opt.go
optpack.go
pack_generate.go
parse_generate.go
parse_test.go
README-dev.md doc: tiny updates 2025年11月27日 09:41:35 +01:00
README-diff-with-v1.md doc: tiny updates 2025年11月27日 09:41:35 +01:00
README.md fix link 2025年11月25日 19:21:46 +01:00
response.go dns: explain how to get tls ConnectionState from Conn() 2025年11月11日 07:19:09 +01:00
reverse.go
router
rr_generate.go
rr_test.go
scan.go *t is always valid, even is the *t is 0 2025年11月24日 17:05:07 +01:00
scan_ednsrr.go
scan_rr.go add IPN RR 2025年11月27日 17:03:42 +01:00
scan_test.go
serve_mux.go dns,servemux: remove mux.z == nil check 2025年11月08日 07:04:53 +01:00
serve_mux_test.go
server.go Fork pool.go off into own package: pool 2025年11月22日 08:03:34 +01:00
server_no_recvmmsg.go Do cap in the put 2025年11月13日 11:45:35 +01:00
server_recvmmsg.go Do cap in the put 2025年11月13日 11:45:35 +01:00
server_test.go
sig0.go
sig0_signer.go
smimea.go Remove t from Header 2025年11月24日 16:22:48 +01:00
sort.go tweak 2025年11月13日 06:51:27 +01:00
sort_rdata.go Fork pool.go off into own package: pool 2025年11月22日 08:03:34 +01:00
sort_test.go Fix sorting 2025年11月04日 14:46:50 +01:00
string.go Remove t from Header 2025年11月24日 16:22:48 +01:00
tlsa.go Remove t from Header 2025年11月24日 16:22:48 +01:00
transfer.go Fork pool.go off into own package: pool 2025年11月22日 08:03:34 +01:00
transfer_test.go
transport.go
tsig.go
tsig_signer.go
tsig_test.go
types.go add IPN RR 2025年11月27日 17:03:42 +01:00
udp.go
udp_darwin.go
udp_no_control.go
udp_session.go
udp_unix.go
version.go Release 0.5.30 2025年11月27日 17:09:08 +01:00
zclone.go add IPN RR 2025年11月27日 17:03:42 +01:00
zcompare.go add IPN RR 2025年11月27日 17:03:42 +01:00
zdnstest.go
zdnsutil.go gen 2025年11月14日 17:08:03 +01:00
zdsolen.go dso: finish remaining types 2025年11月10日 06:57:44 +01:00
zdsorr.go dns: more dso types 2025年11月09日 19:43:26 +01:00
zednspack.go
zednsrr.go
zlen.go add IPN RR 2025年11月27日 17:03:42 +01:00
zmsg.go add IPN RR 2025年11月27日 17:03:42 +01:00
zonemd.go Fork pool.go off into own package: pool 2025年11月22日 08:03:34 +01:00
zonemd_test.go zonemd: Do proper bytes compare, instead of looping of the digest string 2025年11月05日 13:31:45 +01:00
zpack.go add IPN RR 2025年11月27日 17:03:42 +01:00
zparse.go add IPN RR 2025年11月27日 17:03:42 +01:00
zrr.go add IPN RR 2025年11月27日 17:03:42 +01:00

Go Report Card Go Doc status-badge

Even more alternative approach to a DNS library (version 2)

Status

  • Everything from github.com/miekg/dns should work
    • ... and more.
    • see README-diff-with-v1.md for the differences.
  • Fast(er); recvmmsg and pipeling suppport.
    • Since a46996c I can get 370K (UDP) qps on my laptop (M2/Asahi Linux).
    • On my Dell XPS 17 (Intel) it is similar.
    • On Intel/AMD it is lower (200K (UDP) qps) - yet to understand why.
    • See cmd/reflect and do a go build; go test -v. Requires dnsperf to be installed.
  • More convenience functions included in dns or otherwise in dnsutils.
  • Test helper function included dnstest.
  • Example programs included and benchmarked in cmd/, cmd/atomdns runs as a nameserver on my server.

(Previous version is https://github.com/miekg/dns)

Less is more.

Complete and usable DNS library. All Resource Records are supported, including the DNSSEC types. It follows a lean and mean philosophy. Server side and client side programming is supported, i.e. you can build servers and resolvers with it.

We try to keep the "main" branch as sane as possible and at the bleeding edge of standards, avoiding breaking changes wherever reasonable. But because this version is young, we allow ourselves some more headroom.

The naming of types follows the RFCs. EDNS0 types are similarly named, for instance, DHU (Ds Hash Understood). If there is a clash between an actual RR's and an EDNS0 one, the EDNS0 type will get an 'E' as prefix, e.g. EDHU. This will also be done if the RR was named later than the EDNS0 option! The same is the for DSO (DNS Stateful Operations), when clashing those types will be prefixed with a 'D'. If EDNS0 and DSO clash, EDNS0 wins. See [PADDING] and [DPADDING] as an example.

Goals

  • KISS.
  • Everything is an resource record.
  • Small API.
    • Package dnsutil contains functions that help programmers, but are not nessecarily in scope the the dns package.
    • Package dnstest contains functions and types that help you test, similar to the httptest package.
    • Package svcb holds all details of the SVCB/HTTPS record.
    • Pacakge deleg holds details for the DELEG record.
    • Many helper/debug functions are moved into internal packages, making the top-level much, much cleaner.
  • Fast.
    • The cmd/reflect server does 400K/380K UDP/TCP respectively on the right hardware. (As stated, unsure why other machines qps numbers are lower).

Users

A not-so-up-to-date-list-that-may-be-actually-current:

  • atomdns - included in cmd/atomdns - a high performance DNS server, based on the principles of CoreDNS, but faster and simpler.

Send pull request if you want to be listed here.

Features

  • UDP/TCP queries, recvmmsg, TCP query-pipelining, IPv4 and IPv6.
  • Fast(er).
  • RFC 1035 zone file parsing ($INCLUDE, $ORIGIN, $TTL and $GENERATE - for all record types) is supported.
  • Server side programming (mimicking the net/http package), with dns.Handle and dns.HandleFunc allowing for middleware servers.
  • Client side programming.
  • DNSSEC: signing, validating and key generation for DSA, RSA, ECDSA and Ed25519.
  • EDNS0, NSID, Cookies, etc, as pseudo RRs in the (fake) pseudo section.
  • AXFR/IXFR.
  • TSIG, SIG(0).
  • DNS over TLS (DOT): encrypted connection between client and server over TCP.
  • DNS over HTTP (DOH), see the dnshttp package.
  • Improved naming by embracing sub-packages.
  • Examples included the cmd/ directory.
  • Escapes (\DDD and \x) in domain names is not supported (anymore) - the overhead (50-100%) was too high.

Have fun!

Miek Gieben - 2025- - miek@miek.nl

See anonymous users asking for support on why these kind of requests/issues usually get closed pretty swiftly.

Building/developing

This library uses Go modules and uses semantic versioning. Getting the code and working with the library is done via:

git clone git@codeberg.org:miekg/dns # use https if you don't have a codeberg account
cd dns
# $EDTIOR *.go

If you want to use codeberg/miekg/dns in your own project, just do a go get codeberg.org/miekg/dns@latest and import codeberg.org/miekg/dns in your Go files.

Examples

A short "how to use the API" is at the beginning of doc.go (this also will show when you call godoc codeberg.org/miekg/dns). The cmd/ directory contains a reflect example program that is used for benchmarking, and further has atomdns which is full fledged DNS server that is developed in tandem with the library.

Supported RFCs

all of them

  • 103{4,5} - DNS standard
  • 1348 - NSAP record (removed the record)
  • 1982 - Serial Arithmetic
  • 1876 - LOC record
  • 1995 - IXFR
  • 1996 - DNS notify
  • 2136 - DNS Update (dynamic updates)
  • 2181 - RRset definition
  • 2537 - RSAMD5 DNS keys
  • 2065 - DNSSEC (updated in later RFCs)
  • 2671 - EDNS record
  • 2782 - SRV record
  • 2845 - TSIG record
  • 2915 - NAPTR record
  • 2929 - DNS IANA Considerations
  • 3110 - RSASHA1 DNS keys
  • 3123 - APL record
  • 3225 - DO bit (DNSSEC OK)
  • 340{1,2,3} - NAPTR record
  • 3445 - Limiting the scope of (DNS)KEY
  • 3596 - AAAA record
  • 3597 - Unknown RRs
  • 4025 - A Method for Storing IPsec Keying Material in DNS
  • 403{3,4,5} - DNSSEC
  • 4255 - SSHFP record
  • 4343 - Case insensitivity
  • 4408 - SPF record
  • 4509 - SHA256 Hash in DS
  • 4592 - Wildcards in the DNS
  • 4635 - HMAC SHA TSIG
  • 4701 - DHCID
  • 4892 - id.server
  • 5001 - NSID
  • 5155 - NSEC3 record
  • 5205 - HIP record
  • 5702 - SHA2 in the DNS
  • 5936 - AXFR
  • 5966 - TCP implementation recommendations
  • 6605 - ECDSA
  • 6672 - DNAME
  • 6725 - IANA Registry Update
  • 6742 - ILNP DNS
  • 6840 - Clarifications and Implementation Notes for DNS Security
  • 6844 - CAA record
  • 6891 - EDNS0 update
  • 6895 - DNS IANA considerations
  • 6944 - DNSSEC DNSKEY Algorithm Status
  • 6975 - Algorithm Understanding in DNSSEC
  • 7043 - EUI48/EUI64 records
  • 7314 - DNS (EDNS) EXPIRE Option
  • 7477 - CSYNC RR
  • 7828 - TCP-keepalive EDNS0 Option
  • 7553 - URI record
  • 7719 - DNS Terminology
  • 7858 - DNS over TLS: Initiation and Performance Considerations
  • 7871 - EDNS0 Client Subnet
  • 7873 - Domain Name System (DNS) Cookies
  • 8080 - EdDSA for DNSSEC
  • 8482 - Minimal Answers for ANY
  • 8484 - DOH
  • 8499 - DNS Terminology
  • 8659 - DNS Certification Authority Authorization (CAA) Resource Record
  • 8777 - DNS Reverse IP Automatic Multicast Tunneling (AMT) Discovery
  • 8914 - Extended DNS Errors
  • 8976 - Message Digest for DNS Zones (ZONEMD RR)
  • 9250 - DOQ (not implemented, waiting until Go supports QUIC)
  • 9461 - Service Binding Mapping for DNS Servers
  • 9462 - Discovery of Designated Resolvers
  • 9460 - SVCB and HTTPS Records
  • 9499 - DNS Terminology
  • 9567 - DNS Error Reporting
  • 9606 - DNS Resolver Information
  • 9660 - Zone version
  • 9859 - DSYNC RR
  • draft-ietf-compact-denial - CO bit
  • draft-ietf-deleg - DELEG RR

Loosely Based Upon