dns
30 items · generated by scribe fromstdlib/dns.fd· synced 2026-11-15
Contents
- dns_build_query (function)
- dns_v6_text (function)
- dns_parse_response (function)
- DnsRecord (struct)
- dns_parse_records (function)
- DnsCache (struct)
- dns_cache_new (function)
- dns_cache_get (function)
- dns_cache_put (function)
- dns_cache_size (function)
- dns_cache_resolve (function)
- dns_query (function)
- dns_query_records (function)
- dns_resolve_all (function)
- dns_resolve_all_via (function)
- dns_resolve (function)
- dns_resolve_via (function)
- dns_resolve_v6 (function)
- dns_resolve_system (function)
- dns_lookup (function)
dns_build_query
Build a DNS query packet for hostname (A record by default). qtype: 1=A, 28=AAAA, 5=CNAME, 15=MX, 16=TXT. Returns a Vec
pub fn dns_build_query(hostname: str, qtype: i64) -> Vec {Parameters:
hostname:strqtype:i64
Returns: Vec
Defined at line 29
dns_v6_text
An IPv6 address as text (RFC 5952): lowercase hex groups without leading zeros, the longest run of two or more zero groups as ”::”.
pub fn dns_v6_text(groups: Vec<i64>) -> str {Parameters:
groups:Vec<i64>
Returns: str
Defined at line 129
dns_parse_response
Parse a raw DNS response (malloc’d bytes, len long) and return the resolved IPs as Vec
pub fn dns_parse_response(buf: i64, len: i64) -> Vec<str> {Parameters:
buf:i64len:i64
Returns: Vec<str>
Defined at line 167
DnsRecord
One answer of a response: its type (1 A, 28 AAAA), time to live in seconds, and address as text.
pub struct DnsRecord {Fields:
| Name | Type |
|---|---|
rtype | i64 |
ttl | i64 |
addr | str |
Defined at line 180
dns_parse_records
The A and AAAA answers of a raw response (len bytes at buf). Every read is checked against len: a truncated packet gives the answers before the cut.
pub fn dns_parse_records(buf: i64, len: i64) -> Vec<DnsRecord> {Parameters:
buf:i64len:i64
Returns: Vec<DnsRecord>
Defined at line 189
DnsCache
pub struct DnsCache {Fields:
| Name | Type |
|---|---|
names | Vec<str> |
addrs | Vec<Vec<str>> |
expires | Vec<i64> |
Defined at line 240
dns_cache_new
pub fn dns_cache_new() -> DnsCache {Returns: DnsCache
Defined at line 246
dns_cache_get
The cached addresses of name at time now; empty when there are none or they have expired.
pub fn dns_cache_get(c: & DnsCache, name: str, now: i64) -> Vec<str> {Parameters:
c:& DnsCachename:strnow:i64
Returns: Vec<str>
Defined at line 265
dns_cache_put
Keep addrs for name until now + ttl (seconds; names are not case sensitive). A ttl of 0 or less keeps nothing.
pub fn dns_cache_put(c: & mut DnsCache, name: str, addrs: Vec<str>, ttl: i64, now: i64) {Parameters:
c:& mut DnsCachename:straddrs:Vec<str>ttl:i64now:i64
Defined at line 276
dns_cache_size
How many names the cache holds unexpired at now.
pub fn dns_cache_size(c: & DnsCache, now: i64) -> i64 {Parameters:
c:& DnsCachenow:i64
Returns: i64
Defined at line 296
dns_cache_resolve
The A records of hostname: from the cache while they last, else a query to server (its answers then cached for their smallest TTL).
pub fn dns_cache_resolve(c: & mut DnsCache, hostname: str, server: str, now: i64) -> Vec<str> {Parameters:
c:& mut DnsCachehostname:strserver:strnow:i64
Returns: Vec<str>
Defined at line 310
dns_query
Query server (dotted-quad) for hostname qtype; returns Vec
pub fn dns_query(hostname: str, qtype: i64, server: str, port: i64, timeout_ms: i64) -> Vec<str> {Parameters:
hostname:strqtype:i64server:strport:i64timeout_ms:i64
Returns: Vec<str>
Defined at line 334
dns_query_records
The answers to a query, with their TTLs (empty on failure or timeout).
pub fn dns_query_records(hostname: str, qtype: i64, server: str, port: i64, timeout_ms: i64) -> Vec<DnsRecord> {Parameters:
hostname:strqtype:i64server:strport:i64timeout_ms:i64
Returns: Vec<DnsRecord>
Defined at line 346
dns_resolve_all
Resolve hostname to all A records via the default resolver.
pub fn dns_resolve_all(hostname: str) -> Vec<str> {Parameters:
hostname:str
Returns: Vec<str>
Defined at line 380
dns_resolve_all_via
Resolve via a specific resolver IP.
pub fn dns_resolve_all_via(hostname: str, server: str) -> Vec<str> {Parameters:
hostname:strserver:str
Returns: Vec<str>
Defined at line 385
dns_resolve
First A record for hostname, or "" on failure.
pub fn dns_resolve(hostname: str) -> str {Parameters:
hostname:str
Returns: str
Defined at line 390
dns_resolve_via
pub fn dns_resolve_via(hostname: str, server: str) -> str {Parameters:
hostname:strserver:str
Returns: str
Defined at line 398
dns_resolve_v6
All AAAA records for hostname.
pub fn dns_resolve_v6(hostname: str) -> Vec<str> {Parameters:
hostname:str
Returns: Vec<str>
Defined at line 407
dns_resolve_system
Resolve via the OS resolver: nslookup on Windows, getent on Unix. Returns first IPv4 address or "" on failure. Slower than a wire query (process spawn) but needs no socket FFI.
pub fn dns_resolve_system(hostname: str) -> str {Parameters:
hostname:str
Returns: str
Defined at line 491
dns_lookup
Recommended entry point: resolves through the OS resolver, which works on every backend (the wire-format path needs pledge_net linked and panics under fid run if it isn’t). Use dns_resolve()/dns_resolve_via() explicitly for the UDP path.
pub fn dns_lookup(hostname: str) -> str {Parameters:
hostname:str
Returns: str
Defined at line 519
Generated by scribe, the Fides documentation generator