1
0
Fork
You've already forked dns
0
forked from miekg/dns
Go DNS library
  • Go 92.2%
  • Roff 7.7%
delichik 74a2dd2594 maybe redundant go?
delete the redundant go
Signed-off-by: delichik <delichik@imiku.moe>
2025年10月24日 05:51:56 +02:00
.woodpecker ci: add go generate 2025年10月20日 16:24:59 +02:00
cmd atomdns: nicer banner 2025年10月23日 15:32:45 +02:00
deleg Test external RRs 2025年10月15日 14:15:07 +02:00
dnsconf Fix tests 2025年09月06日 18:04:45 +02:00
dnshttp chore: fix spell and fmt errors 2025年10月09日 20:26:18 +02:00
dnstest Add Read function, next to New to allow reading from a io.Reader 2025年09月24日 07:05:00 +02:00
dnsutil Fix template 2025年10月18日 15:34:48 +02:00
internal chore: fix spell and fmt errors 2025年10月09日 20:26:18 +02:00
svcb Test external RRs 2025年10月15日 14:15:07 +02:00
testdata More testing and toying with opt 2025年08月11日 09:24:52 +02:00
.changelog.go.tmpl typo in changelog 2025年10月03日 18:35:01 +02:00
bench_test.go Fix broken things after moving UnpackName to unpack.Name 2025年08月30日 14:11:28 +02:00
CHANGELOG.md changelog 2025年10月14日 17:15:45 +02:00
ci_test.go delete correct binaries 2025年09月16日 17:18:56 +02:00
client.go Pull signing out of client 2025年09月02日 16:12:55 +02:00
clone_generate.go chore: fix spell and fmt errors 2025年10月09日 20:26:18 +02:00
compare_generate.go Better zcompare.go 2025年10月15日 15:57:18 +02:00
CONTRIBUTORS First code dump 2025年08月06日 08:11:49 +02:00
COPYRIGHT Fix copyright 2025年09月04日 13:49:40 +02:00
dane.go Un-export CertificateToDANE 2025年08月16日 12:43:33 +02:00
dns.go Finish external RR code 2025年10月16日 08:29:07 +02:00
dnssec.go Some lint issues 2025年10月15日 09:21:04 +02:00
dnssec_keygen.go More msg_helpers.go to internal/{un,}pack 2025年09月01日 20:22:45 +02:00
dnssec_keyscan.go Fix initial setup 2025年09月14日 08:23:28 +02:00
dnssec_privkey.go More msg_helpers.go to internal/{un,}pack 2025年09月01日 20:22:45 +02:00
dnssec_signer.go dnssec: correctly set signbuf size 2025年09月29日 20:27:35 +02:00
dnssec_test.go dnssec: correctly set signbuf size 2025年09月29日 20:27:35 +02:00
dnstest_generate.go Docs and clean up of comments 2025年10月06日 16:13:59 +02:00
dnsutil_generate.go Docs and clean up of comments 2025年10月06日 16:13:59 +02:00
doc.go Finish external RR code 2025年10月16日 08:29:07 +02:00
dso_types.go typo 2025年08月17日 21:34:17 +02:00
dsolen_generate.go DSO: add some basic generators 2025年08月16日 10:45:23 +02:00
dsorr_generate.go Generate compare functions 2025年08月23日 09:42:16 +02:00
edns_types.go atomdns: Use *Node in zones 2025年10月11日 08:44:58 +02:00
ednsrr_generate.go Test external RRs 2025年10月15日 14:15:07 +02:00
errors.go Some lint issues 2025年10月15日 09:21:04 +02:00
generate.go zoneparser: SetInclude is now IncludeAllowFunc 2025年10月14日 17:06:42 +02:00
go.mod more geoip stuff 2025年10月17日 21:43:12 +02:00
go.sum more geoip stuff 2025年10月17日 21:43:12 +02:00
headerpack.go Split off msg_helpers into pack*.go files, just like packsvcb and packdeleg. 2025年09月03日 07:31:23 +02:00
len_generate.go Finish all embedded types 2025年10月13日 19:58:29 +02:00
LICENSE add status to the readme 2025年08月18日 07:28:14 +02:00
listen_no_socket_options.go clean udp socket stuff 2025年09月01日 14:59:36 +02:00
listen_socket_options.go Fix server startup 2025年09月13日 11:29:12 +02:00
Makefile.release Release 0.0.2 2025年08月18日 15:00:46 +02:00
msg.go Some lint issues 2025年10月15日 09:21:04 +02:00
msg_generate.go Finish all embedded types 2025年10月13日 19:58:29 +02:00
msg_test.go Add Fuzz tests 2025年09月26日 20:47:01 +02:00
nsecpack.go Run internal/analysis/modernize/cmd/modernize 2025年10月15日 09:03:57 +02:00
opt.go Preliminary DELEG support bits 2025年08月29日 20:51:46 +02:00
optpack.go return error 2025年09月07日 09:52:17 +02:00
pack_generate.go Lots of churn just to move stuff into internal/pack 2025年08月23日 08:37:09 +02:00
parse_generate.go More docs 2025年10月15日 15:42:23 +02:00
parse_test.go Add NSID presentation parsing 2025年09月29日 19:21:26 +02:00
pool.go atomdns: Use *Node in zones 2025年10月11日 08:44:58 +02:00
README-dev.md Update READMEs 2025年09月30日 07:19:07 +02:00
README-diff-with-v1.md dnsfmt is not needed 2025年10月16日 07:49:04 +02:00
README.md Update readme 2025年10月12日 10:33:42 +02:00
response.go dnsserver: also for *tls.Conn for dot 2025年10月04日 10:33:13 +02:00
reverse.go Some lint issues 2025年10月15日 09:21:04 +02:00
router Add zerr.go 2025年09月14日 08:26:44 +02:00
rr_generate.go Test external RRs 2025年10月15日 14:15:07 +02:00
rr_test.go Finish external RR code 2025年10月16日 08:29:07 +02:00
scan.go Parse to and from string 2025年10月15日 15:07:46 +02:00
scan_ednsrr.go Some lint issues 2025年10月15日 09:21:04 +02:00
scan_rr.go Run internal/analysis/modernize/cmd/modernize 2025年10月15日 09:03:57 +02:00
scan_test.go zoneparser: SetInclude is now IncludeAllowFunc 2025年10月14日 17:06:42 +02:00
serve_mux.go Small documentation updates 2025年10月08日 20:49:51 +02:00
serve_mux_test.go Skip reflect perf testing by default 2025年08月17日 12:06:55 +02:00
server.go maybe redundant go? 2025年10月24日 05:51:56 +02:00
server_test.go make dnstest.Server better 2025年08月26日 14:53:33 +02:00
sig0.go Small documentation updates 2025年10月08日 20:49:51 +02:00
sig0_signer.go More msg_helpers.go to internal/{un,}pack 2025年09月01日 20:22:45 +02:00
smimea.go Move more to dnsutil 2025年08月25日 20:26:06 +02:00
sort.go Everything is ported over 2025年09月16日 13:07:21 +02:00
sort_test.go atomdns: dbfile: add tests that shows problem 2025年10月05日 20:16:42 +02:00
string.go atomdns: Use *Node in zones 2025年10月11日 08:44:58 +02:00
tlsa.go test: allow dnstest primitives also to be used 2025年09月03日 07:15:28 +02:00
transfer.go Some lint issues 2025年10月15日 09:21:04 +02:00
transfer_test.go Pull signing out of client 2025年09月02日 16:12:55 +02:00
transport.go Pull signing out of client 2025年09月02日 16:12:55 +02:00
tsig.go More 2025年09月16日 10:12:08 +02:00
tsig_signer.go signing: allow for options everywhere 2025年09月02日 07:19:12 +02:00
tsig_test.go Domain -> Name, and a few other things 2025年08月28日 07:09:22 +02:00
types.go atomdns: Use *Node in zones 2025年10月11日 08:44:58 +02:00
udp.go udp: optimize for IPv4, set control flags on darwin. 2025年09月15日 10:40:02 -07:00
udp_darwin.go udp: optimize for IPv4, set control flags on darwin. 2025年09月15日 10:40:02 -07:00
udp_no_control.go udp: optimize for IPv4, set control flags on darwin. 2025年09月15日 10:40:02 -07:00
udp_session.go Split out dns.Session to avoid repeating 2025年09月14日 08:17:41 +02:00
udp_unix.go udp: optimize for IPv4, set control flags on darwin. 2025年09月15日 10:40:02 -07:00
version.go Release 0.5.14 2025年10月16日 08:32:55 +02:00
zclone.go Fix 2025年10月02日 10:37:51 +02:00
zcompare.go Better zcompare.go 2025年10月15日 15:57:18 +02:00
zdnstest.go Go gen + docs 2025年09月24日 13:24:39 +02:00
zdnsutil.go Test external RRs 2025年10月15日 14:15:07 +02:00
zdsolen.go DSO: add some basic generators 2025年08月16日 10:45:23 +02:00
zdsorr.go Generate compare functions 2025年08月23日 09:42:16 +02:00
zednspack.go dns: remove pack.*Octet 2025年10月08日 07:35:35 +02:00
zednsrr.go Test external RRs 2025年10月15日 14:15:07 +02:00
zlen.go Finish all embedded types 2025年10月13日 19:58:29 +02:00
zmsg.go Finish all embedded types 2025年10月13日 19:58:29 +02:00
zpack.go Add DSYNC RR 2025年09月29日 09:32:12 +02:00
zparse.go More docs 2025年10月15日 15:42:23 +02:00
zrr.go Test external RRs 2025年10月15日 14:15:07 +02:00

Go Report Card status-badge

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

Status

  • Everything from github.com/miekg/dns should work
    • ... and more.
  • Fast(er); recvmmsg and pipeling suppport.
    • Since a46996c I can get 400K qps on my laptop (M2/Asahi Linux).
    • On my Dell XPS 17 (Intel) it is similar.
    • On Intel/AMD it is lower (200K 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 for my domains.

(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.

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.

Have fun!

Miek Gieben - 2025- - miek@miek.nl

Building

This library uses Go modules and uses semantic versioning. Building is done with the go tool, so the following should work:

go get codeberg.org/miekg/dns
go build codeberg.org/miekg/dns

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 few example programs.

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