// Package traverse implements the core DNS traversal engine for ExploreDNS, // a Go port of the Ruby dnstraverse engine (dns.squish.net). // // The traversal starts from a synthetic "rootroot" node (never displayed) // with one child per root server, and explores every branch of the // delegation instead of stopping at the first authoritative answer, so lame // delegations, missing glue and split authorities are all visible. // // # Architecture // // A Traverser runs an explicit stack loop over Referral nodes. Each Referral // queries every IP address of one nameserver for one qname/qclass/qtype, // classifies each response (DecodedQuery, ServerResponse) and creates one // child per NS name for referral/restart statuses — including glueless // nameservers, which get their own resolve subtree (refid ".0." components) // queried from this branch's cache, never a system resolver. Post-order // stack markers fold the statistics upwards once all children finished: // every leaf outcome carries a probability, and the probabilities at the // root sum to 1.0. // // # Caching // // Two caches cooperate: the packet-level cache in internal/dns sends each // (server IP, question, udpsize) at most once per run, and the hierarchical // per-branch InfoCache holds the in-bailiwick records each response is // allowed to contribute. Fast mode (default) additionally memoises completed // referrals so identical subtrees are reported as "completed earlier" // instead of being walked again. package traverse