netio/dns/resolver.rs#
Source: lib/netio/dns/resolver.rs
the resolver: queries over UDP and TCP and the encrypted transports, answers bound to their
question (read_reply), the search list, the cache
enum Replywhat an answer says about its questionFound(Lookup)-- the name exists: its records of the type (none: NODATA) and how long they may be keptNoName(Option<u32>)-- no such name (NXDOMAIN); how many seconds that may be kept (None: not at all, no SOA)Truncated-- too large for UDP: ask over TCPNoEdns-- FORMERR without EDNS in the answer to a query with it: ask again without (RFC 6891 7)Failed(u16)-- the server failed or refused (its whole RCODE: SERVFAIL 2, NOTIMP 4, REFUSED 5, ...)Bad-- malformed, or not an answer to the query
fn read_reply(m: &[u8], q: &[u8]) -> Replywhat the answermsays to the queryq(both whole messages): the id, the response bit, a standard query, the question, the RCODE; the records of the asked name or of the end of its CNAME chain in the answer section, of the asked type and class INstruct Resolvera resolver with its configuration, its encrypted servers' connections and a cache
impl Resolver
fn new(cfg: Config) -> Resolvera resolver of this configuration with a cache of 1000 entriesfn system() -> Resolverthis computer's configuration (Config::system)fn with_cache(self, entries: usize) -> Resolvera cache of at most this many answers (0: none)fn config(&self) -> &Configthe configuration it was made withfn clear_cache(&self)forgets the cached answers (and what DNSSEC knows of zones)fn lookup(&self, name: &str, rtype: u16) -> NetResult<Lookup>the records ofnameof typertype(see the top of dns.rs)fn resolve(&self, host: &str, port: u16) -> NetResult<Vec<SocketAddr>>the addresses of a host (as dns::resolve_with: numbers, localhost, the hosts file, the app's permissions), A and AAAA through this resolver and its cache