This is a clone/fork of https://github.com/miekg/dns
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Spencer Comfort d8fbd0a755
Update actions & add go 1.19.x and 1.20.x to go workflow (#1414)
2 months ago
.github/workflows Update actions & add go 1.19.x and 1.20.x to go workflow (#1414) 2 months ago
dnsutil Fix typos (#1413) 2 months ago
.codecov.yml Add codecov yaml to not fail the build (#600) 5 years ago
.gitignore gitignore update 10 years ago
AUTHORS add AUTHOR file 9 years ago
CODEOWNERS Add CODEOWNERS (#1042) 3 years ago
CONTRIBUTORS Correctly set the Source IP to the received Destination IP (#524) 6 years ago
COPYRIGHT Remove all copyright notices 9 years ago
LICENSE Restructure license so Github will recognize it. (#1397) 4 months ago
Makefile.fuzz Add fuzzing framework (#580) 5 years ago
Makefile.release Spelling (#1222) 2 years ago
README.md readme: add some very thankful users (#1415) 2 months ago
acceptfunc.go Run gofmt -w -s *.go (#1408) 3 months ago
acceptfunc_test.go Support generic net.PacketConn's for the Server (#1174) 2 years ago
client.go Fix typos (#1413) 2 months ago
client_test.go Add back support for *net.UnixCon with seqpacket type (#1378) 10 months ago
clientconfig.go Use for range loops instead of manual for loops (#937) 4 years ago
clientconfig_test.go fix: panicing on options parsing. (#642) 5 years ago
dane.go Improve performance by addressing some low hanging fruit. (#444) 6 years ago
defaults.go Disallow names that start with '.' in IsDomainName() (#1376) 10 months ago
dns.go Fix Rdlength related parsing bug in RFC3597 records (#1214) 2 years ago
dns_bench_test.go ZoneParser: error on parsing an IPv6 address in an A record (#923) 4 years ago
dns_test.go Properly calculate compressed message lengths (#833) 4 years ago
dnssec.go Fix RSAMD5 keytag calucation. (#1353) 12 months ago
dnssec_keygen.go Use ed25519 from Go standard lib (#1243) 2 years ago
dnssec_keyscan.go Use ed25519 from Go standard lib (#1243) 2 years ago
dnssec_privkey.go Use ed25519 from Go standard lib (#1243) 2 years ago
dnssec_test.go Fix RSAMD5 keytag calucation. (#1353) 12 months ago
doc.go Run gofmt -w -s *.go (#1408) 3 months ago
duplicate.go Doc updates (#1075) 3 years ago
duplicate_generate.go Run gofmt -w -s *.go (#1408) 3 months ago
duplicate_test.go Implement SVCB (#1067) 2 years ago
dyn_test.go Remove all copyright notices 9 years ago
edns.go Update edns.go (#1409) 3 months ago
edns_test.go Fix edns keepalive (#1317) 1 year ago
example_test.go Fix examples by using net.JoinHostPort (#1368) 12 months ago
format.go Add checks on data length for A and AAAA records (#919) 4 years ago
format_test.go Add checks on data length for A and AAAA records (#919) 4 years ago
fuzz.go Run gofmt -w -s *.go (#1408) 3 months ago
fuzz_test.go Spelling (#1222) 2 years ago
generate.go Fix potentially truncated int casts in $GENERATE code (#1212) 2 years ago
generate_test.go Fix potentially truncated int casts in $GENERATE code (#1212) 2 years ago
go.mod Fix go generate missing required go.mod entry (#1290) 2 years ago
go.sum Fix go generate missing required go.mod entry (#1290) 2 years ago
hash.go Add indentityHash for algos that don't need hashing (#1340) 1 year ago
issue_test.go tests: reduce timeouts and iterations (#1175) 2 years ago
labels.go Remove space between NextLabel func and doc comment (#1410) 3 months ago
labels_test.go Disallow names that start with '.' in IsDomainName() (#1376) 10 months ago
leak_test.go Revert doh (#800) 4 years ago
length_test.go Make the 900 number lower in this test (#1176) 2 years ago
listen_no_reuseport.go Run gofmt -w -s *.go (#1408) 3 months ago
listen_reuseport.go Run gofmt -w -s *.go (#1408) 3 months ago
msg.go Run gofmt -w -s *.go (#1408) 3 months ago
msg_generate.go Run gofmt -w -s *.go (#1408) 3 months ago
msg_helpers.go Add more detail to NSEC packing errors (#1374) 10 months ago
msg_helpers_test.go Invalid NSEC/3 bitmap on non-zero buffer (#1338) 12 months ago
msg_test.go Add test for forward compression pointer (#1123) 3 years ago
msg_truncate.go Update Truncate doc with compress behaviour (#1217) 2 years ago
msg_truncate_test.go Fix typos (#1413) 2 months ago
nsecx.go Doc updates (#1075) 3 years ago
nsecx_test.go Add a HashName benchmark 4 years ago
parse_test.go Run gofmt -w -s *.go (#1408) 3 months ago
privaterr.go small cleans from go report card (#1268) 2 years ago
privaterr_test.go refactor: remove ParseZone and parseZone (#1099) 3 years ago
reverse.go Move all reversed map creation into reverse.go (#889) 4 years ago
rr_test.go Eliminate lexer goroutines (#792) 5 years ago
sanitize.go Avoid calling RR.Header more than once per RR (#891) 4 years ago
sanitize_test.go Tests updates (#556) 5 years ago
scan.go zoneparser: document not checking syntax (#1245) 2 years ago
scan_rr.go small cleans from go report card (#1268) 2 years ago
scan_test.go Fix Rdlength related parsing bug in RFC3597 records (#1214) 2 years ago
serve_mux.go answer queries with no matching handler with RcodeRefused (#1151) 3 years ago
serve_mux_test.go Rework and optimise ServeMux (#754) 5 years ago
server.go Fix typos (#1413) 2 months ago
server_test.go Add back support for *net.UnixCon with seqpacket type (#1378) 10 months ago
sig0.go Add indentityHash for algos that don't need hashing (#1340) 1 year ago
sig0_test.go Add indentityHash for algos that don't need hashing (#1340) 1 year ago
singleinflight.go Prevent timeout in TestConcurrentExchanges (#862) 4 years ago
smimea.go Simplify and unify various returns (#893) 4 years ago
svcb.go Fix typos (#1413) 2 months ago
svcb_test.go Properly parse alpn values in SVCB (#1363) 11 months ago
tlsa.go Simplify and unify various returns (#893) 4 years ago
tools.go Run gofmt -w -s *.go (#1408) 3 months ago
tsig.go Make tsigGenerateProvider/TsigVerifyProvider public (#1382) 9 months ago
tsig_test.go Make tsigGenerateProvider/TsigVerifyProvider public (#1382) 9 months ago
types.go small cleans from go report card (#1268) 2 years ago
types_generate.go Run gofmt -w -s *.go (#1408) 3 months ago
types_test.go Be consistent about domain name label character escaping (#1122) 3 years ago
udp.go Run gofmt -w -s *.go (#1408) 3 months ago
udp_test.go Run gofmt -w -s *.go (#1408) 3 months ago
udp_windows.go Run gofmt -w -s *.go (#1408) 3 months ago
update.go fix Msg.Used TTL must be zero (#1280) 2 years ago
update_test.go Fix typos (#1413) 2 months ago
version.go Release 1.1.50 9 months ago
version_test.go Doc updates (#1075) 3 years ago
xfr.go Run gofmt -w -s *.go (#1408) 3 months ago
xfr_test.go Support TsigProvider for Server and Transfer (#1331) 1 year ago
zduplicate.go Implementation of zone digest (ZONEMD) (#1208) 2 years ago
zmsg.go Implementation of zone digest (ZONEMD) (#1208) 2 years ago
ztypes.go Implementation of zone digest (ZONEMD) (#1208) 2 years ago

README.md

Build Status Code Coverage Go Report Card

Alternative (more granular) approach to a DNS library

Less is more.

Complete and usable DNS library. All 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.

Goals

  • KISS;
  • Fast;
  • Small API. If it's 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
  • Server side programming (mimicking the net/http package)
  • Client side programming
  • DNSSEC: signing, validating and key generation for DSA, RSA, ECDSA and Ed25519
  • EDNS0, NSID, Cookies
  • AXFR/IXFR
  • TSIG, SIG(0)
  • DNS over TLS (DoT): encrypted connection between client and server over TCP
  • DNS name compression

Have fun!

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

Building

This library uses Go modules and uses semantic versioning. Building is done with the go tool, so 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
  • 3123 - APL record
  • 3225 - DO bit (DNSSEC OK)
  • 340{1,2,3} - NAPTR record
  • 3445 - Limiting the scope of (DNS)KEY
  • 3597 - Unknown RRs
  • 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
  • 6944 - DNSSEC DNSKEY Algorithm Status
  • 6975 - Algorithm Understanding in DNSSEC
  • 7043 - EUI48/EUI64 records
  • 7314 - DNS (EDNS) EXPIRE Option
  • 7477 - CSYNC RR
  • 7828 - edns-tcp-keepalive EDNS0 Option
  • 7553 - URI record
  • 7858 - DNS over TLS: Initiation and Performance Considerations
  • 7871 - EDNS0 Client Subnet
  • 7873 - Domain Name System (DNS) Cookies
  • 8080 - EdDSA for DNSSEC
  • 8499 - DNS Terminology
  • 8659 - DNS Certification Authority Authorization (CAA) Resource Record
  • 8914 - Extended DNS Errors
  • 8976 - Message Digest for DNS Zones (ZONEMD RR)

Loosely Based Upon