package dns-client

  1. Overview
  2. Docs
DNS client API

Install

dune-project
 Dependency

Authors

Maintainers

Sources

dns-10.2.0.tbz
sha256=ad27c09256f9848658ee625d69140c898c24694aca43550bfb6fee5bc83e74e8
sha512=d5d6a0580d55485cbe46841fb8d5acd7de801bf6ce980f31888836425e39f23f3ff2e909c5f195b15a36166ae97ecd68d24429318028ae8d1ea9322df2f5a65d

doc/dns-client/Dns_client/Make/index.html

Module Dns_client.MakeSource

Parameters

module T : S

Signature

Sourcetype t

The abstract type of a DNS client.

Sourceval transport : t -> T.t

transport t is the transport of t.

Sourceval create : ?cache_size:int -> ?edns:[ `None | `Auto | `Manual of Dns.Edns.t ] -> ?nameservers:(Dns.proto * T.io_addr list) -> ?timeout:int64 -> T.stack -> t

create ~cache_size ~edns ~nameservers ~timeout stack creates the state of the DNS client. We use timeout (ns, default 5s) as a time budget for connect and request timeouts. To specify a timeout, use create ~timeout:(Duration.of_sec 3). Whether or not to use EDNS in queries is controlled by ~edns (defaults to `None): if None, no EDNS will be present, `Auto adds TCP Keepalive if protocol is TCP, `Manual edns adds the EDNS data specified.

Sourceval nameservers : t -> Dns.proto * T.io_addr list

nameservers state returns the list of nameservers to be used.

Sourceval getaddrinfo : t -> 'response Dns.Rr_map.key -> 'a Domain_name.t -> ('response, [> `Msg of string ]) result T.io

getaddrinfo state query_type name is the query_type-dependent response regarding name, or an Error _ message. See Dns_client.query_state for more information about the result types.

Sourceval gethostbyname : t -> [ `host ] Domain_name.t -> (Ipaddr.V4.t, [> `Msg of string ]) result T.io

gethostbyname state hostname is the IPv4 address of hostname resolved via the state specified. If the query fails, or if the domain does not have any IPv4 addresses, an Error _ message is returned. Any extraneous IPv4 addresses are ignored. For an example of using this API, see unix/ohost.ml in the distribution of this package.

Sourceval gethostbyname6 : t -> [ `host ] Domain_name.t -> (Ipaddr.V6.t, [> `Msg of string ]) result T.io

gethostbyname6 state hostname is the IPv6 address of hostname resolved via the state specified.

It is the IPv6 equivalent of gethostbyname.

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 T.io

get_resource_record state query_type name resolves query_type, name via the state specified. The behaviour is equivalent to getaddrinfo, apart from the error return value - get_resource_record distinguishes some errors, at the moment No_data if the name exists, but not the query_type, and No_domain if the name does not exist. This allows clients to treat these error conditions explicitly.

Sourceval get_raw_reply : t -> 'response Dns.Rr_map.key -> 'a Domain_name.t -> (Dns.Packet.reply, [> `Partial | `Msg of string ]) result T.io

get_raw_reply state query_type name resolves query_type, name via the state specified. The complete DNS reply is returned. CNAME records are not followed. This allows DNSSec to process the entire reply.

OCaml

Innovation. Community. Security.