Module Luv.DNS

DNS queries.

See Querying DNS in the user guide and DNS utility functions in libuv.

This module exposes two main functions, Luv.DNS.getaddrinfo and Luv.DNS.getnameinfo. Both take an optional request object. By default, Luv allocates and manages request objects internally. However, a user-provided request object allows the user to cancel requests using Luv.Request.cancel.

See Luv.File for a similar API with more detailed discussion.

module Addr_info : sig ... end

Binds struct addrinfo and request objects for Luv.DNS.getaddrinfo.

module Name_info : sig ... end

Optional flags and request objects for use with Luv.DNS.getnameinfo.

val getaddrinfo : ?⁠loop:Loop.t -> ?⁠request:Addr_info.Request.t -> ?⁠family:Sockaddr.Address_family.t -> ?⁠socktype:Sockaddr.Socket_type.t -> ?⁠protocol:int -> ?⁠flags:Addr_info.Flag.t list -> ?⁠node:string -> ?⁠service:string -> unit -> ((Addr_info.t listError.t) Result.result -> unit) -> unit

Retrieves addresses.

Binds uv_getaddrinfo. See getaddrinfo(3).

uv_getaddrinfo and getaddrinfo(3) take optional hints in fields of an argument of type struct addrinfo. Luv.DNS.getaddrinfo instead has several optional arguments, each named after one of the fields of hints.

val getnameinfo : ?⁠loop:Loop.t -> ?⁠request:Name_info.Request.t -> ?⁠flags:Name_info.Flag.t list -> Sockaddr.t -> ((string * string, Error.t) Result.result -> unit) -> unit

Retrieves host names.

Binds uv_getnameinfo. See getnameinfo(3).