feat: add DNS query/response layer with miekg/dns

Phase 1.2 implementation:

- internal/dns/types.go: DNS record type constants (A, AAAA, NS, CNAME, SOA,
  MX, TXT, SRV, PTR, ANY) with QNameType helper and EDNS0 defaults
- internal/dns/query.go: Query/QueryWithExchange with UDP, configurable
  EDNS0 buffer size, TCP fallback on truncation, always-TCP mode, configurable
  retries with timeout, context support, and injectable ExchangeFunc for testing
- internal/dns/decode.go: Response classification (answer, referral, NODATA,
  NXDOMAIN, SERVFAIL), CNAME chain extraction with dedup, truncation/RCODE
  detection, and section extraction utilities

32 unit tests covering all acceptance criteria.

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
Gary
2026-06-05 15:14:56 +10:00
co-authored by multica-agent
parent afdf7df891
commit fce7920611
8 changed files with 1150 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
module github.com/hits/ExploreDNS
go 1.25.6
require github.com/miekg/dns v1.1.72
require (
golang.org/x/mod v0.31.0 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/tools v0.40.0 // indirect
)