Domain Name Service (DNS) lookup via the libresolv standard library routines

LTS Haskell 22.30:
Stackage Nightly 2024-07-22:
Latest on Hackage:

See all snapshots resolv appears in

GPL-2.0-or-later licensed by Herbert Valerio Riedel
Maintained by Alexey Radkov
This version can be pinned in stack with:resolv-,5006

Module documentation for

This package implements an API for accessing the Domain Name Service (DNS) resolver service via the standard libresolv system library (whose API is often available directly via the standard libc C library) on Unix systems.

This package also includes support for decoding message record types as defined in the following RFCs:

  • RFC 1035: Domain Names - Implementation And Specification

  • RFC 1183: New DNS RR Definitions

  • RFC 2782: A DNS RR for specifying the location of services (DNS SRV)

  • RFC 2915: The Naming Authority Pointer (NAPTR) DNS Resource Record

  • RFC 3596: DNS Extensions to Support IP Version 6

  • RFC 4034: Resource Records for the DNS Security Extensions

  • RFC 4255: Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints

  • RFC 4408: Sender Policy Framework (SPF) for Authorizing Use of Domains in E-Mail, Version 1

  • RFC 5155: DNS Security (DNSSEC) Hashed Authenticated Denial of Existence

  • RFC 6844: DNS Certification Authority Authorization (CAA) Resource Record

  • RFC 6891: Extension Mechanisms for DNS (EDNS(0))

  • RFC 7553: The Uniform Resource Identifier (URI) DNS Resource Record

For Windows, the package windns provides a compatible subset of this package's API.


See also

Revision history for resolv

2023-06-12, Alexey Radkov and Andreas Abel

  • Support Haiku OS by including libnetwork in configure script. (PR #23.)

2023-03-31, Alexey Radkov and Andreas Abel

  • Fix Ship updated configure script.

2023-03-31, Alexey Radkov and Andreas Abel

  • Bump bytestring to >= 0.10 for correct IsString ByteString instance. (PR #16.)
  • Fix memory leaks due to missing res_nclose() after each res_ninit() call. (PR #12.)
  • Check the value of h_errno on failures of res_nquery() and throw an appropriate exception of type DnsException built with one of new constructors DnsHostNotFound, DnsNoData, DnsNoRecovery, or DnsTryAgain. Note that previously such exceptions were thrown by fail and had type IOError. (PR #17.)
  • Suppress configure warning on option --with-compiler passed by Cabal. (PR #21.)
  • Tested with GHC 8.0 - 9.6.

2020-03-27, Herbert Valerio Riedel

  • Add new high-level API functions queryPTR, arpaIPv4, and arpaIPv6 for performing reverse address lookups.

2019-08-26, Herbert Valerio Riedel

  • GHC 8.8 / base-4.13 only compat hotfix release; the next release will support older GHC/base versions again.

2018-10-27, Herbert Valerio Riedel

  • Clarify/relax licensing terms.

2017-10-26, Herbert Valerio Riedel

  • Improve Autoconf script.

2017-10-22, Herbert Valerio Riedel

  • Use Autoconf to detect which library (if any) to link for res_query(3).
  • Use reentrant res_nquery(3) API if available and signal via new resIsReentrant :: Bool constant.
  • Expose DnsException and QR.

2017-10-22, Herbert Valerio Riedel

  • First version. Released on an unsuspecting world.