def try.from

bend-kit-dns@0.7.0.0 · dns.bend:443

import bend-kit-dns@0.7.0.0/dns.bend as Dns
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

443# A datagram from anyone but the nameserver's port 53 is ignored (retried).
444def try.from(s: Socket, +ns: String, id: U32, hpd: String & U32 & (U32 & Array<U32>)) -> IO(Socket & Try):
445  (h, +p, d) = hpd
446  (n, w) = d
447  try.pure(s, Bool.pick(Try, Bool.and(String.eq(h, ns), U32.is_eq(p, 53)), Got{answer(id, Bytes.Bytes{n, w})}, Again{}))

Uses (15)

Used by (1)