getaddrinfo gives you A and AAAA. system-resolver gives you any record type — HTTPS/SVCB, CAA, TLSA — from the same resolver under the same policy, because it sends no packets of its own.
No socket, no cache, no retries, no resolv.conf parsing. Whatever your machine applies still applies — per-interface servers, a VPN's split DNS, Android's Private DNS, macOS's supplemental resolvers and .local, the OS cache — because the machine is what answers. That is the difference from hickory-resolver and the c-ares bindings, which are their own resolvers talking to the servers in resolv.conf, and from dns-lookup, which gives what getaddrinfo gives.
// RR type 65, HTTPS (RFC 9460) for record in system_resolver::lookup("cloudflare.com", 65)? { println!("{} ttl {:?} rdata {} bytes", record.name, record.ttl, record.rdata.len()); }
res_query on Linux and FreeBSD, DNSServiceQueryRecord on Apple, android_res_nquery on Android, DnsQueryRaw on Windows 11, DnsQuery_UTF8 on Windows 10.
RDATA is bytes and stays bytes — pair it with a decoder that takes a type and some octets: hickory-proto's RData::read, domain's parse_rdata. Names inside are written out in full, so a bare field decodes out of context.
What it won't do: musl can't ask for types above 255, so CAA and URI are out there; Windows 10 refuses 16 types by name; Apple can't tell NXDOMAIN from NODATA; no header, so no AD or TC; it's blocking; FreeBSD compiles on every push but has never been run.
MSRV 1.85, MIT/Apache-2.0
Source: r/rust · by /u/GamePad64