Library and tools for creating forwarding DNS servers



type t
type clock = Clock.t
type address = Config.Address.t
type message_cb = ?src:address -> ?dst:address -> buf:Cstruct.t -> unit -> unit Lwt.t

A callback called per message, which permits recording and analysis. If an address is unknown (e.g. it is selected by the kernel when routing the packets) then the corresponding argument will be omitted

val create : ?local_names_cb:( Dns.Packet.question -> Dns.Packet.rr list option Lwt.t ) -> gen_transaction_id:( int -> int ) -> ?message_cb:message_cb -> Config.t -> clock -> t Lwt.t

Construct a resolver given some configuration

val destroy : t -> unit Lwt.t

Destroy and free all resources associated with the resolver

val answer : Cstruct.t -> t -> Cstruct.t Error.t

Process a query by first checking whether the name can be satisfied locally via the local_names_cb and failing that, sending it to upstream servers according to the resolver configuration. The call will block forever if no server with a timeout is chosen; the client should be prepared to timeout and cancel the thread.