type +'a io = 'a Lwt.tio is the type of an effect. 'err is a polymorphic variant.
type io_addr = Ipaddr.V4.t * intAn address for a given context type, usually this will consist of IP address + a TCP/IP or UDP/IP port number, but for some context types it can carry additional information for purposes of cryptographic verification. TODO at least that would be nice in the future. TODO
type ns_addr = [ `TCP | `UDP ] * io_addrTODO well this is kind of crude; it's a tuple to prevent having to do endless amounts of currying things when implementing context types, and we need to know the protocol used so we can prefix packets for DNS-over-TCP and set correct socket options etc. therefore we can't just use the opaque io_addr. TODO
type stack = S.tA stack with which to connect, e.g. IPv4.tcpv4
create ~nameserver ~timeout stack creates the state record of the DNS client. We use timeout (ns) as a cumulative time budget for connect and request timeouts.
The address of a nameserver that is supposed to work with the underlying context, can be used if the user does not want to bother with configuring their own.
val rng : int -> Cstruct.trng t is a random number generator.
val connect : ?nameserver:ns_addr -> t -> (context, [> `Msg of string ]) Stdlib.result ioconnect addr is a new connection (context) to addr, or an error.
val send : context -> Cstruct.t -> (unit, [> `Msg of string ]) Stdlib.result iosend context buffer sends buffer to the context upstream.
val recv : context -> (Cstruct.t, [> `Msg of string ]) Stdlib.result iorecv context tries to read a buffer from the context downstream.
val lift : 'a -> 'a io