package dns-client

  1. Overview
  2. Docs

Parameters

module R : Mirage_random.S
module T : Mirage_time.S
module M : Mirage_clock.MCLOCK
module P : Mirage_clock.PCLOCK

Signature

module Transport : Dns_client.S with type io_addr = [ `Plaintext of Ipaddr.t * int | `Tls of Tls.Config.client * Ipaddr.t * int ] and type +'a io = 'a Lwt.t with type stack = S.t
include sig ... end
val create : ?size:int -> ?edns:[ `Auto | `Manual of Dns.Edns.t | `None ] -> ?nameservers:(Dns.proto * Transport.io_addr list) -> ?timeout:int64 -> Transport.stack -> t
val nameservers : t -> Dns.proto * Transport.io_addr list
val getaddrinfo : t -> 'response Dns.Rr_map.key -> 'a Domain_name.t -> ('response, [> `Msg of string ]) Stdlib.result Transport.io
val gethostbyname : t -> [ `host ] Domain_name.t -> (Ipaddr.V4.t, [> `Msg of string ]) Stdlib.result Transport.io
val gethostbyname6 : t -> [ `host ] Domain_name.t -> (Ipaddr.V6.t, [> `Msg of string ]) Stdlib.result Transport.io
val 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 ]) Stdlib.result Transport.io
val get_raw_reply : t -> 'response Dns.Rr_map.key -> 'a Domain_name.t -> (Dns.Packet.reply, [> `Msg of string | `Partial ]) Stdlib.result Transport.io
val nameserver_of_string : string -> (Transport.io_addr, [> `Msg of string ]) Stdlib.result

nameserver_of_string authenticators str returns a Transport.io_addr from the given string. The format is:

  • tcp:<ipaddr>(:port)? for a simple nameserver and we will communicate with it via the TCP/IP protocol
  • tls:<ipaddr>(:port)?(!authenticator)? for a nameserver and we will communicate with it via the TCP/IP protocol plus the TLS encrypted layer. The user can verify the nameserver via an authenticator (see X509.Authenticator.of_string for the format of it). By default, Ca_certs_nss.authenticator is used.
val connect : ?nameservers:string list -> ?timeout:int64 -> Transport.stack -> t Lwt.t

connect ?nameservers ?timeout stack creates a DNS entity which is able to resolve domain-name. It expects few optional arguments:

  • nameservers a list of nameservers used to resolve domain-names
  • timeout (in nanoseconds), passed to create
OCaml

Innovation. Community. Security.