Skip to content
Go
Latest commit 48ab660 May 12, 2016 @erikdubbelboer erikdubbelboer committed with go fmt (#355)
Failed to load latest commit information.
dnsutil Added new functions: TrimDomainName()/AddOrigin() Jan 25, 2016
idn tidyup a little with the latest golang.org/x/tools/cmd/vet Sep 29, 2015
.gitignore gitignore update Oct 15, 2013
.travis.yml Go 1.6 for travis Feb 22, 2016
AUTHORS add AUTHOR file Feb 10, 2014
CONTRIBUTORS Changed logic to typeswitch and added comments. Sep 20, 2014
COPYRIGHT Remove all copyright notices Sep 11, 2014
LICENSE Update the copy right for the original GO files May 12, 2013
README.md Add serf-dns to the user list (#353) May 7, 2016
client.go Add Client.Timeout to allow limiting total exchange duration (#345) Apr 19, 2016
client_test.go Add Client.Timeout to allow limiting total exchange duration (#345) Apr 19, 2016
clientconfig.go A bunch of golint fixes Feb 19, 2015
clientconfig_test.go Lowercase all error msg from the tests Nov 26, 2015
defaults.go IsSubDomain docs Apr 12, 2016
dns.go golint fixes Aug 23, 2015
dns_test.go IsSubDomain docs Apr 12, 2016
dnssec.go HINFO does not need downcasing for DNSSEC Oct 6, 2015
dnssec_keygen.go Refactor DNSSEC to use crypto.{PrivateKey,Signer} Aug 19, 2015
dnssec_keyscan.go Refactor DNSSEC to use crypto.{PrivateKey,Signer} Aug 19, 2015
dnssec_privkey.go Refactor DNSSEC to use crypto.{PrivateKey,Signer} Aug 19, 2015
dnssec_test.go Lowercase all error msg from the tests Nov 26, 2015
doc.go typo Jan 23, 2016
dyn_test.go Remove all copyright notices Sep 11, 2014
edns.go massage edns cookie comment May 3, 2016
edns_test.go Put the correct extended rcode in OPT Apr 9, 2016
example_test.go fix a stupid mistake "undefined: zone" Sep 30, 2015
format.go Typo in comment Jan 13, 2015
fuzz_test.go Check for l.err in $INCLUDE Aug 8, 2015
issue_test.go better comment Feb 28, 2016
labels.go go fmt (#355) May 12, 2016
labels_test.go Added new functions: TrimDomainName()/AddOrigin() Jan 25, 2016
msg.go Check length before packing OPT (#352) May 5, 2016
nsecx.go A bunch of golint fixes Feb 19, 2015
nsecx_test.go More test clean up Feb 25, 2015
parse_test.go gofmt -s Jan 22, 2016
privaterr.go Expose TypeToRR Oct 16, 2015
privaterr_test.go Lowercase all error msg from the tests Nov 26, 2015
rawmsg.go Remove the duplicate word length from the comment Dec 31, 2015
remote_test.go Add remote test Aug 22, 2015
sanitize.go some memory optimisations Aug 31, 2015
sanitize_test.go gofmt -s Jan 22, 2016
scanner.go Remove all copyright notices Sep 11, 2014
server.go spelling Jan 19, 2016
server_test.go Add option in server to allow DNS over TLS Jan 8, 2016
sig0.go Refactor DNSSEC to use crypto.{PrivateKey,Signer} Aug 19, 2015
sig0_test.go Lowercase all error msg from the tests Nov 26, 2015
singleinflight.go Implement outstanding query detection. Aug 24, 2013
tlsa.go Missing dot between service and protocol. Feb 27, 2016
tsig.go TSIG: lowercase algorithm before use Mar 7, 2016
tsig_test.go TSIG: lowercase algorithm before use Mar 7, 2016
types.go Apply per-type code generation to .copy() Oct 7, 2015
types_generate.go Use package name more reliably. (#343) Apr 14, 2016
types_test.go Add tests for LOC record String() generation and fix small problems Dec 10, 2014
udp.go fix building on plan9 Mar 21, 2016
udp_linux.go Set UDP conn to non-blocking on Linux to fix Shutdown() Dec 1, 2015
udp_other.go fix building on plan9 Mar 21, 2016
udp_plan9.go fix building on plan9 Mar 21, 2016
udp_windows.go Export UDP interfaces Mar 9, 2015
update.go An update msg can have multiple, different prerequests and also multi… Feb 27, 2016
update_test.go TestPreReqAndRemovals should become Example Feb 28, 2016
xfr.go Small fix in docs for transfer Out Mar 28, 2016
xfr_test.go Lowercase all error msg from the tests Nov 26, 2015
zgenerate.go spelling Jan 19, 2016
zscan.go fix typos Jan 4, 2016
zscan_rr.go gofmt -s Jan 22, 2016
ztypes.go Expose TypeToRR Oct 16, 2015

README.md

Build Status

Alternative (more granular) approach to a DNS library

Less is more.

Complete and usable DNS library. All widely used Resource Records are supported, including the DNSSEC types. It follows a lean and mean philosophy. If there is stuff you should know as a DNS programmer there isn't a convenience function for it. Server side and client side programming is supported, i.e. you can build servers and resolvers with it.

We try to keep the "master" branch as sane as possible and at the bleeding edge of standards, avoiding breaking changes wherever reasonable. We support the last two versions of Go, currently: 1.5 and 1.6.

Goals

  • KISS;
  • Fast;
  • Small API, if its easy to code in Go, don't make a function for it.

Users

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

Send pull request if you want to be listed here.

Features

  • UDP/TCP queries, IPv4 and IPv6;
  • RFC 1035 zone file parsing ($INCLUDE, $ORIGIN, $TTL and $GENERATE (for all record types) are supported;
  • Fast:
    • Reply speed around ~ 80K qps (faster hardware results in more qps);
    • Parsing RRs ~ 100K RR/s, that's 5M records in about 50 seconds;
  • Server side programming (mimicking the net/http package);
  • Client side programming;
  • DNSSEC: signing, validating and key generation for DSA, RSA and ECDSA;
  • EDNS0, NSID, Cookies;
  • AXFR/IXFR;
  • TSIG, SIG(0);
  • DNS over TLS: optional encrypted connection between client and server;
  • DNS name compression;
  • Depends only on the standard library.

Have fun!

Miek Gieben - 2010-2012 - miek@miek.nl

Building

Building is done with the go tool. If you have setup your GOPATH correctly, the following should work:

go get github.com/miekg/dns
go build github.com/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 github.com/miekg/dns).

Example programs can be found in the github.com/miekg/exdns repository.

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 - there is no RRset type though, just []RR
  • 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
  • 3225 - DO bit (DNSSEC OK)
  • 340{1,2,3} - NAPTR record
  • 3445 - Limiting the scope of (DNS)KEY
  • 3597 - Unknown RRs
  • 4025 - IPSECKEY
  • 403{3,4,5} - DNSSEC + validation functions
  • 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
  • 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
  • 6975 - Algorithm Understanding in DNSSEC
  • 7043 - EUI48/EUI64 records
  • 7314 - DNS (EDNS) EXPIRE Option
  • 7553 - URI record
  • xxxx - EDNS0 DNS Update Lease (draft)
  • yyyy - DNS over TLS: Initiation and Performance Considerations (draft)
  • xxxx - Domain Name System (DNS) Cookies (draft-ietf-dnsop-cookies)

Loosely based upon

  • ldns
  • NSD
  • Net::DNS
  • GRONG

TODO

  • privatekey.Precompute() when signing?
  • Last remaining RRs: APL, ATMA, A6, NSAP and NXT.
  • Missing in parsing: ISDN, UNSPEC, NSAP and ATMA.
  • NSEC(3) cover/match/closest enclose.
  • Replies with TC bit are not parsed to the end.
Something went wrong with that request. Please try again.