package dns-lwt

  1. Overview
  2. Docs

This type of module provides functions for parsing, marshalling and processing DNS requests to produce answers.

include Dns.Protocol.SERVER
type context
val query_of_context : context -> Dns.Packet.t

Projects a context into its associated query

val parse : Cstruct.t -> context option

DNS wire format parser function.

  • parameter buf

    message buffer

  • returns

    parsed packet and context

val marshal : ?alloc:(unit -> Cstruct.t) -> context -> Dns.Packet.t -> Cstruct.t option

DNS wire format marshal function.

  • parameter alloc

    allocator

  • parameter _q

    context

  • parameter response

    answer packet

  • returns

    buffer to write

val process : context process

DNS responder function. Takes an abstract request plus source and destination endpoint addresses, and asynchronously produces an answer to the request, or None if no answer is possible.