package dns-server
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=ad27c09256f9848658ee625d69140c898c24694aca43550bfb6fee5bc83e74e8
sha512=d5d6a0580d55485cbe46841fb8d5acd7de801bf6ce980f31888836425e39f23f3ff2e909c5f195b15a36166ae97ecd68d24429318028ae8d1ea9322df2f5a65d
doc/dns-server/Dns_server/Primary/index.html
Module Dns_server.Primary
Source
The state of a primary DNS server.
data s
is the data store of s
.
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.t * string list) list
with_keys s now ts keys
replaces the current keys with keys
in s
, and generates notifications.
trie_cache s
is the trie cache of the server.
val create :
?trie_cache_entries:int ->
?keys:('a Domain_name.t * Dns.Dnskey.t) list ->
?unauthenticated_zone_transfer:bool ->
?tsig_verify:Dns.Tsig_op.verify ->
?tsig_sign:Dns.Tsig_op.sign ->
rng:(int -> string) ->
Dns_trie.t ->
s
create ~trie_cache_entries ~keys ~unauthenticated_zone_transfer ~tsig_verify ~tsig_sign ~rng data
creates a primary server. If unauthenticated_zone_transfer
is provided and true
(defaults to false
), anyone can transfer the zones. trie_cache_entries
is the backlog to keep in memory for incremental zone transfers (IXFR, default is 5). This affects memory usage.
val handle_packet :
?packet_callback:packet_callback ->
s ->
Ptime.t ->
int64 ->
Dns.proto ->
Ipaddr.t ->
int ->
Dns.Packet.t ->
'a Domain_name.t option ->
s
* Dns.Packet.t option
* (Ipaddr.t * string list) list
* [> `Notify of Dns.Soa.t option | `Keep ] option
handle_packet ~packet_callback 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. If packet_callback
is specified, it is called for each incoming query. If it returns Some reply
, this reply is used instead of the usual lookup in the zone data. It can be used for custom query processing, such as for load balancing or transporting data.
val handle_buf :
?packet_callback:packet_callback ->
s ->
Ptime.t ->
int64 ->
Dns.proto ->
Ipaddr.t ->
int ->
string ->
s
* string list
* (Ipaddr.t * string list) list
* [ `Notify of Dns.Soa.t option
| `Signed_notify of Dns.Soa.t option
| `Keep ]
option
* [ `raw ] Domain_name.t option
handle_buf ~packet_callback 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 a list of answers 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. If packet_callback
is specified, it is called for each incoming query. If it returns Some reply
, this reply is used instead of the usual lookup in the zone data. This can be used for custom query processing, such as for load balancing or transporting data.
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.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).