package dns-server

  1. Overview
  2. Docs
type s

The state of a primary DNS server.

val server : s -> t

server s is the server of the primary.

val data : s -> Dns_trie.t

data s is the data store of s.

val with_data : s -> Ptime.t -> int64 -> Dns_trie.t -> s * (Ipaddr.V4.t * Cstruct.t list) list

with_data s now ts trie replaces the current data with trie in s. The returned notifications should be send out.

val with_keys : s -> Ptime.t -> int64 -> ('a Domain_name.t * Dns.Dnskey.t) list -> s * (Ipaddr.V4.t * Cstruct.t list) list

with_keys s now ts keys replaces the current keys with keys in s, and generates notifications.

val create : ?keys:('a Domain_name.t * Dns.Dnskey.t) list -> ?a:Authentication.a list -> ?tsig_verify:Dns.Tsig_op.verify -> ?tsig_sign:Dns.Tsig_op.sign -> rng:(int -> Cstruct.t) -> Dns_trie.t -> s

create ~keys ~a ~tsig_verify ~tsig_sign ~rng data creates a primary server.

val handle_packet : s -> Ptime.t -> int64 -> Dns.proto -> Ipaddr.V4.t -> int -> Dns.Packet.t -> 'a Domain_name.t option -> s * Dns.Packet.t option * (Ipaddr.V4.t * Cstruct.t list) list * [> `Notify of Dns.Soa.t option | `Keep ] option

handle_packet s now ts src src_port proto key packet handles the given packet, returning new state, an answer, and potentially notify packets to secondary name servers.

val handle_buf : s -> Ptime.t -> int64 -> Dns.proto -> Ipaddr.V4.t -> int -> Cstruct.t -> s * Cstruct.t option * (Ipaddr.V4.t * Cstruct.t list) list * [ `Notify of Dns.Soa.t option | `Signed_notify of Dns.Soa.t option | `Keep ] option * [ `raw ] Domain_name.t option

handle_buf s now ts proto src src_port buffer decodes the buffer, processes the DNS frame using handle_packet, and encodes the reply. The result is a new state, potentially an answer to the requestor, a list of notifications to send out, information whether a notify (or signed notify) was received, and the hmac key used for authentication.

val closed : s -> Ipaddr.V4.t -> s

closed s ip marks the connection to ip closed.

val timer : s -> Ptime.t -> int64 -> s * (Ipaddr.V4.t * Cstruct.t list) list

timer s now ts may encode some notifications to secondary name servers if previous ones were not acknowledged.

val to_be_notified : s -> [ `host ] Domain_name.t -> (Ipaddr.V4.t * [ `raw ] Domain_name.t option) list

to_be_notified s zone returns a list of pairs of IP address and optional tsig key name of the servers to be notified for a zone change. This list is based on (a) NS entries for the zone, (b) registered TSIG transfer keys, and (c) active connection (which transmitted a signed SOA).

OCaml

Innovation. Community. Security.