silo:std.effects.dns

Source src/silo:std.effects.dns

1##! Dns effect — forward and reverse DNS resolution.
2##!
3##! Sub-effect of `Net`. Hostnames and addresses are carried as `Str`
4##! today; the typed `IpAddr` union and `DnsError` type arrive with the
5##! full host handler.
6
7:use
8  :open core Str Vec Result
9  :open effects.net Net
10:end
11
12# si[impl effect.dns.decl]
13## DNS resolution effect. Hostnames and IP-address textual forms are
14## carried as `Str` in this placeholder decl.
15:effect(pub) Dns Net
16  # si[impl effect.dns.resolve]
17  ## Resolve a hostname to all associated IP addresses (textual form).
18  ## Returns a non-empty vector on success.
19  .resolve ( Str -> (Result (Vec Str) Str) )
20  # si[impl effect.dns.resolve-one]
21  ## Resolve a hostname to a single IP address (textual form).
22  .resolve-one ( Str -> (Result Str Str) )
23  # si[impl effect.dns.reverse-lookup]
24  ## Reverse-lookup an IP address (textual form) to its hostname.
25  .reverse-lookup ( Str -> (Result Str Str) )
26:end