package dns-server

  1. Overview
  2. Docs
type s

The state of a secondary DNS server.

val data : s -> Dns_trie.t

data s is the zone data of s.

val with_data : s -> Dns_trie.t -> s

with_data s trie is s with its data replaced by trie.

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

create ~primary ~tsig_verify ~tsig_sign ~rng keys creates a secondary DNS server state.

val handle_packet : s -> Ptime.t -> int64 -> Ipaddr.t -> Dns.Packet.t -> 'a Domain_name.t option -> s * Dns.Packet.t option * (Ipaddr.t * Cstruct.t) option

handle_packet s now ts ip proto key t handles the incoming packet.

val handle_buf : s -> Ptime.t -> int64 -> Dns.proto -> Ipaddr.t -> Cstruct.t -> s * Cstruct.t option * (Ipaddr.t * Cstruct.t) option

handle_buf s now ts proto src buf decodes buf, processes with handle_packet, and encodes the results.

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

timer s now ts may request SOA or retransmit AXFR.

val closed : s -> Ptime.t -> int64 -> Ipaddr.t -> s * Cstruct.t list

closed s now ts ip marks ip as closed, the returned buffers (SOA requests) should be sent to ip.