package dns-client

  1. Overview
  2. Docs

Parameters

module T : S

Signature

type t
val create : ?size:int -> ?rng:(int -> Cstruct.t) -> ?nameserver:T.ns_addr -> clock:(unit -> int64) -> T.stack -> t

create ~size ~rng ~nameserver ~clock stack creates the state of the DNS client.

val nameserver : t -> T.ns_addr

nameserver t returns the default nameserver to be used.

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

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

val gethostbyname : t -> ?nameserver:T.ns_addr -> [ `host ] Domain_name.t -> (Ipaddr.V4.t, [> `Msg of string ]) Stdlib.result T.io

gethostbyname state ~nameserver domain is the IPv4 address of domain resolved via the state and nameserver 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.

val gethostbyname6 : t -> ?nameserver:T.ns_addr -> [ `host ] Domain_name.t -> (Ipaddr.V6.t, [> `Msg of string ]) Stdlib.result T.io

gethostbyname6 state ~nameserver domain is the IPv6 address of domain resolved via the state and nameserver specified.

It is the IPv6 equivalent of gethostbyname.

OCaml

Innovation. Community. Security.