Up

module Protocol

: sig
#
exception Dns_resolve_timeout
#
exception Dns_resolve_error of exn list
#
module type CLIENT = sig

The type of pluggable DNS resolver modules for request contexts and custom metadata and wire protocols.

#
type context
#
val get_id : unit -> int
#
val marshal : ?alloc:(unit -> Buf.t) -> Packet.t -> (context * Buf.t) list

marshal query is a list of context-buffer pairs corresponding to the channel contexts and request buffers with which to attempt DNS requests. Requests are made in parallel and the first response to successfully parse is returned as the answer. Lagging requests are kept running until successful parse or timeout. With this behavior, it is easy to construct low-latency but network-environment-aware DNS resolvers.

#
val parse : context -> Buf.t -> Packet.t option

parse ctxt buf is the potential packet extracted out of buf with ctxt

#
val timeout : context -> exn

timeout ctxt is the exception resulting from a context ctxt that has timed-out

end
#
module Client : CLIENT

The default DNS resolver using the standard DNS protocol

#
module type SERVER = sig

The type of pluggable DNS server modules for request contexts and custom metadata dn wire protocols.

#
type context
#
val query_of_context : context -> Packet.t

Projects a context into its associated query

#
val parse : Buf.t -> context option

DNS wire format parser function.

buf message buffer
Returns parsed packet and context
#
val marshal : Buf.t -> context -> Packet.t -> Buf.t option
end
#
module Server : SERVER with type context = Packet.t

The default DNS server using the standard DNS protocol

#
val contain_exc : string -> (unit -> 'a) -> 'a option
end