package mnet-dns

  1. Overview
  2. Docs
An implementation of DNS in OCaml for Miou & Solo5

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mnet-0.0.7.tbz
sha256=efcef0d0452c6b6b5d5a618bff47250fd873d4cd317d0a51ee349c4a5cb84d9a
sha512=5c0d2b5a1967c592138525f6f706457b45833f4f86a98c7cede0128edce4104e227361025bacc4c888bf73499c8438df95d51f990f93515cd4a2ce5f89e01caa

doc/mnet-dns/Mnet_dns/index.html

Module Mnet_dnsSource

Mnet_dns is a specialization of Dns_client with Miou and Mnet.

It proposes a DNS client which is able to talk to nameservers via:

  • UDP
  • TCP
  • and TLS

To be able to initiate such a client, you must prepare, at least, something to talk throught UDP and TCP. About the latter, we use the Happy Eyeballs algorithm to race multiple DNS nameservers and take the quickest one. The user must create a Transport.stack from an UDP witness and an Happy Eyeballs witness:

  let he, hed = Mnet_happy_eyeballs.create tcp in
  Fun.protect
    ~finally:(fun () -> Mnet_happy_eyeballs.kill hed) @@ fun () ->
  let stack = Mnet_dns.Transport.stack udp he in
  let dns = Mnet_dns.create ~nameservers stack in
  ...

The user is able to decide the size of internal buffers used for TCP and TLS connections. A limit of 0x20000 of these buffers is applied by default and the initial size of it is 0x800 bytes. It's mainly due to we probably can receive truncated DNS packets but they can not be bigger than 0x10000 bytes. The user is able to reduce this limit and enlarge (or reduce) the initial size of these buffers. They are allocated per TCP or TLS connections.

A daemon exists when the user create a new DNS client and it must be killed at the end of your application:

  let daemon = Mnet_dns.transport dns in
  Fun.protect
    ~finally:(fun () -> Mnet_dns.Transport.kill daemon) @@ fun () ->
  ...
Sourcemodule Key : sig ... end
Sourcemodule UReqs : Map.S with type key = Key.t
Sourcemodule Reqs : Map.S with type key = int
Sourcemodule Transport : sig ... end
include sig ... end
Sourceval transport : t -> Transport.t
Sourceval create : ?cache_size:??? -> ?edns:??? -> ?nameservers:??? -> ?timeout:??? -> Transport.stack -> t
Sourceval nameservers : t -> Dns.proto * Transport.io_addr list
Sourceval getaddrinfo : t -> 'response Dns.Rr_map.key -> 'a Domain_name.t -> ('response, [> `Msg of string ]) result Transport.io
Sourceval gethostbyname : t -> [ `host ] Domain_name.t -> (Ipaddr.V4.t, [> `Msg of string ]) result Transport.io
Sourceval gethostbyname6 : t -> [ `host ] Domain_name.t -> (Ipaddr.V6.t, [> `Msg of string ]) result Transport.io
Sourceval get_resource_record : t -> 'response Dns.Rr_map.key -> 'a Domain_name.t -> ('response, [> `Msg of string | `No_data of [ `raw ] Domain_name.t * Dns.Soa.t | `No_domain of [ `raw ] Domain_name.t * Dns.Soa.t ]) result Transport.io
Sourceval get_raw_reply : t -> 'response Dns.Rr_map.key -> 'a Domain_name.t -> (Dns.Packet.reply, [> `Msg of string | `Partial ]) result Transport.io