Module Dns_server.Secondary

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 -> string) -> ('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 : ?packet_callback:packet_callback -> s -> Ptime.t -> int64 -> Ipaddr.t -> Dns.Packet.t -> 'a Domain_name.t option -> s * Dns.Packet.t option * (Ipaddr.t * string) option

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

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

handle_buf ~packet_callback 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 * string list) list

timer s now ts may request SOA or retransmit AXFR.

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

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