package dns-resolver

  1. Overview
  2. Docs
DNS resolver business logic

Install

dune-project
 Dependency

Authors

Maintainers

Sources

dns-10.2.3.tbz
sha256=c895b2d112c4aa60c0987a09eb59f0d9602bd804fecf4124795be16e4a86734a
sha512=c51c3d123a89fcde187771d405df0be7282c44c9597bdfa54ca9eedc89347a6346ff4ef461ef65557d1b1d0e50eb7d42a39267ffa11bedf1feb37d38f459e10d

doc/dns-resolver/Dns_resolver/index.html

Module Dns_resolverSource

Sourcetype t

The type of a DNS resolver.

Sourcetype feature = [
  1. | `Dnssec
  2. | `Qname_minimisation
  3. | `Opportunistic_tls_authoritative
]
Sourceval create : ?add_reserved:bool -> ?record_clients:bool -> ?cache_size:int -> ?ip_protocol:[ `Both | `Ipv4_only | `Ipv6_only ] -> feature list -> Ptime.t -> int64 -> (int -> string) -> Dns_server.Primary.s -> t

create ~add_reserved ~record_clients ~cache_size ~ip_protocol features now ts rng primary creates the value of a resolver, pre-filled with root NS and their IP addresses. If ip_protocol is provided, and set to `V4_only, only IPv4 packets will be emitted. If `V6_only is set, only IPv6 packets will be emitted. If `Both (the default), either IPv4 and IPv6 packets are emitted. If record_clients is true (the default), the metrics of the resolver will include the amount of clients. This keeps a set of Ipaddr.t of all clients around, which may use some memory if it is a public resolver.

The add_reserved is by default true, and adds reserved zones (from RFC 6303, 6761, 6762) to the primary server (see Dns_resolver_root.reserved_zones).

Some features can be specified, whether DNSSec validation should be done, whether query name minimisation should be done, and whether opportunistic encryption using TLS to the authoritative should be done.

Sourceval features : t -> feature list
Sourceval handle_buf : t -> Ptime.t -> int64 -> bool -> Dns.proto -> Ipaddr.t -> int -> string -> t * (Dns.proto * Ipaddr.t * int * int32 * string * Dns.Packet.Question.t * Dns.Rcode.t * int64 * string) list * (Dns.proto * Ipaddr.t * string) list

handle_buf t now ts query_or_reply proto sender source-port buf handles resolution of buf, which leads to a new t, a list of answers to be transmitted (tuple of protocol, ip address, port, minimum ttl, buffer, question, rcode, duration it took, status), and a list of queries (triple of protocol, ip address, buffer).

Sourceval query_root : t -> int64 -> Dns.proto -> t * (Dns.proto * Ipaddr.t * string)

query_root t now proto potentially requests an update of the root zone. Best invoked by a regular timer.

Sourceval timer : t -> int64 -> t * (Dns.proto * Ipaddr.t * int * int32 * string * Dns.Packet.Question.t * Dns.Rcode.t * int64 * string) list * (Dns.proto * Ipaddr.t * string) list

timer t now potentially retransmits DNS requests and/or sends NXDomain answers.

Sourceval primary_data : t -> Dns_trie.t

primary_data t is the DNS trie of the primary.

Sourceval with_primary_data : t -> Ptime.t -> int64 -> Dns_trie.t -> t * (Ipaddr.t * string list) list

with_primary_data t now ts data is a pair (t', outs) where t' is t updated with the data DNS trie, and outs is the data to send out (if any).