dns-client is a part of the ocaml-dns distribution which provides 3 sub-packages:
dns-client.unix for an usual use of it
dns-client.lwt which is the same as dns-client.unix but with lwt
dns-client.mirage which is a special one for MirageOS
Let’s pick the first one. To ask the MX record to a domain, you should write:
let getmxbydomain domain =
let dns = Dns_client_unix.create () in
Dns_client_unix.getaddrinfo dns Dns.Rr_map.Mx domain
let () =
let domain = Domain_name.of_string_exn Sys.argv.(1) in
let _ttl, response = Rresult.R.failwith_error_msg (getmxbydomain domain) in
Fmt.pr "@[<hov>%a@]\n%!" Fmt.(Dump.list Dns.Mx.pp) (Dns.Rr_map.Mx_set.elements response)
Hi, if you’re still having a problem, and can provide me with a sample bit of code to compile and the invocation you used, I’m happy to help you debug.