dnsbase
Copyright(c) Viktor Dukhovni 2026
LicenseBSD-3-Clause
Maintainerietf-dane@dukhovni.org
Stabilityunstable
Safe HaskellNone
LanguageGHC2024

Net.DNSBase

Description

A DNS stub-resolver library with a typed RData model and a runtime extension API. The IO layer is derived from Kazu Yamamoto's dns package; what dnsbase layers on top sits in the RR-data model and the configuration story.

Every RR type's payload is modeled via a dedicated Haskell type — these include, for example, the recent SVCB / HTTPS service-binding records, with up-to-date extensible SvcParam coverage. EDNS option support includes Extended DNS Errors (EDE) with a user-extensible info-code name table. Coverage of both widely used and historical DNS RR types is comprehensive — only the most marginal obsolete or experimental types remain unimplemented. Individual payloads are held uniformly inside the existential RData wrapper, so an RR value can carry any type's data.

The basic lookup interface (lookupA, lookupMX, lookupTXT, …) is deliberately similar to dns; the differences are concentrated in the typed-data layer and the configuration surface.

Extending the library

Applications can extend the library with any missing RRTYPEs, EDNS(0) options, or SVCB and HTTPS service parameter values. Application-specified data types take precedence over any existing or later added built-in implementations.

Extensions are registered by constructing a pure resolver configuration value, rather than via IO actions on mutable global state. Adding custom data types to the library does not require a source-code fork. See Adding a custom RR type and Adding a custom EDNS option for detailed examples.

Concurrency

Like its dns ancestor, dnsbase scales well to thousands of forkIO threads, with throughput of around ten thousand distinct queries (not even cache hits) per second observed when given sufficient concurrency, a high file descriptor limit and a cooperative upstream iterative resolver.

A single ResolvSeed configuration can be used to derive per-thread Resolver instances via withResolver. As in dns, concurrent use of the same Resolver in multiple threads is not supported.

A minimal example

import Net.DNSBase
import Control.Exception (throwIO)
import System.IO (stdout)

main :: IO ()
main = makeResolvSeed defaultResolvConf >>= \ case
  Left  e    -> throwIO e
  Right seed -> withResolver seed \ r ->
    lookupMX r $$(dnLit8 "ietf.org") >>= \ case
      Left  e   -> throwIO e
      Right mxs -> hPutBuilder stdout $ foldr presentLn mempty mxs

makeResolvSeed builds a ResolvSeed from a ResolverConf; the default reads /etc/resolv.conf. The setters:

compose with defaultResolvConf to override individual fields.

Inside a withResolver block the per-RRtype lookup combinators, such as:

each return a list of matching records. Applications that want to process the full DNSMessage response can use lookupRaw or lookupRawCtl.

The dnLit and dnLit8 Template-Haskell splices make it possible to validate a literal domain name at compile time. The idna2008 package provides compatible parsers for Unicode internationalised domain names (IDNs).

Module tour

This all-in-one module re-exports almost the entire public API. Specific topics are covered in:

Synopsis

Resolver setup

Static resolver configuration

data ResolverConf Source #

User-supplied resolver configuration. Carries the caller's choices: where nameservers come from, the per-attempt timeout and retry budget, default QueryControls, and any user-registered RR-type / EDNS option codecs. Built-in defaults are not stored here — they are merged into the effective configuration only when makeResolvSeed produces a ResolvSeed.

defaultResolvConf :: ResolverConf Source #

Default resolver configuration, with nameserver list from /etc/resolv.conf and no user-registered codec extensions.

data NameserverConf Source #

Configuration file name, or explicit list of addresses/hostnames.

data NameserverSpec Source #

Nameserver address string or hostname, with optional port.

Resolver seeds

data ResolvSeed Source #

Resolved, immutable resolver state built by makeResolvSeed from a ResolverConf. Combines the user's choices with the library's built-in defaults: resolved nameserver addresses, and the effective RR-type and EDNS-option codec maps with user-registered code points overriding the library defaults (except at a small set of protected code points, where attempted user overrides are silently ignored).

A ResolvSeed is safe to share across threads; each query-issuing thread should call withResolver on the same seed to obtain its own per-thread Resolver handle.

makeResolvSeed :: ResolverConf -> IO (Either DNSError ResolvSeed) Source #

Build a ResolvSeed from a ResolverConf. The seed is immutable and safely shared across threads; each thread then calls withResolver to obtain its own Resolver.

The configured nameservers are resolved to socket addresses, and the user's codec registrations (from registerRRtype, extendRRwithType and registerEdnsOption) are combined with the library's built-in codec set. At each RR-type or EDNS option code point, the user-registered codec takes precedence over the library default — except at a small set of protected code points (e.g. the SVCB mandatory key), where any attempted user override is silently ignored.

Returns Left err if the configured nameservers cannot be resolved or the configuration file cannot be parsed.

Example:

>>> seed <- makeResolvSeed defaultResolvConf >>= either throwIO pure

Derived resolver objects

data Resolver Source #

Internal DNS Resolver handle, obtained via withResolver. Must not be used concurrently in multiple threads.

withResolver :: ResolvSeed -> (Resolver -> IO a) -> IO a Source #

Provide a Resolver to the supplied action. Concurrent use of a single Resolver is not supported: the handle carries internal mutable state and the library makes no soundness guarantees if it is shared across threads. Programs that issue queries from multiple threads must call withResolver once per worker thread (typically inside forkIO) to obtain a separate handle. The ResolvSeed itself is immutable and is the right object to share across threads.

The action runs in plain IO; DNS-protocol errors from individual lookups appear in the Either DNSError a return shape of each lookup function inside the action. This function does not itself produce or propagate DNSErrors.

Queries

type Lookup a = Resolver -> Domain -> IO (Either DNSError [a]) Source #

Shape of a typed lookup: a Resolver and a query Domain produce either a list of answers, or a DNSError. An empty list means that either the name exists and has no records of the queried type (NODATA), or the name does not exist (NXDOMAIN). Both are non-error outcomes.

extractAnswers :: DNSMessage -> IO (Either DNSError [RR]) Source #

Given a DNSMessage return answer RRs that match its question, possibly after chasing CNAME aliases within the answer section of the message.

lookupRaw :: Resolver -> Domain -> RRCLASS -> RRTYPE -> IO (Either DNSError DNSMessage) Source #

Perform a raw lookup returning the full DNSMessage or a DNSError. See lookupRawCtl for the variant that takes per-call query controls.

lookupRawCtl :: Resolver -> QueryControls -> Domain -> RRCLASS -> RRTYPE -> IO (Either DNSError DNSMessage) Source #

Perform a raw lookup with per-call QueryControls overrides, returning the full DNSMessage or a DNSError. The supplied controls are merged into the resolver's ambient query controls: only the flag and EDNS bits specified in the controls affect the outgoing query, the rest are inherited from the resolver configuration. Use lookupAnswers (or the per-RRtype Lookup functions) when you want only the answer RRs for the requested name and type, rather than the entire response DNSMessage.

lookupAnswers :: Resolver -> QueryControls -> RRCLASS -> RRTYPE -> Domain -> IO (Either DNSError [RR]) Source #

Perform the requested query and return the answer RRs from the response, or a DNSError carrying the RCODE for error responses. The QueryControls argument carries per-call tweaks; it is merged onto the resolver's ambient query controls, so callers only need to specify the flag and EDNS bits they want to change, the rest are inherited from the resolver configuration.

Note that NXDOMAIN is not a lookup error. An empty list of RRs is returned for both NODATA and NXDOMAIN.

If the nameserver's response does not include any RRs matching query name and type, but does include a CNAME record for the requested name, the response is (recursively) rescanned for records matching that name and type instead. Note, no additional queries are issued if the final CNAME found does not lead to any record of the desired record type.

The returned RRs may include covering DNSSEC signatures when the DOflag is set as part of the QueryControls, and the response was signed.

The presence of RRSIG records does not however imply that the response was validated by the resolver. For that one would typically use a trusted DNSSEC-validating local (loopback) resolver, to which the network path is immune to potential active attacks, and inspect the ADflag in the response message.

The full response DNSMessage can be obtained via lookupRawCtl.

lookupA :: Lookup IPv4 Source #

IPv4 addresses of query domain.

lookupAAAA :: Lookup IPv6 Source #

IPv6 addresses of query domain.

lookupMX :: Lookup T_mx Source #

MX RData of query domain.

lookupNS :: Lookup Domain Source #

Nameservers of query domain.

lookupCNAME :: Lookup Domain Source #

CNAMEs of query domain (should be at most one).

lookupPTR :: Lookup Domain Source #

PTR names of query domain.

lookupTXT :: Lookup (NonEmpty ShortByteString) Source #

TXT RData of query domain. Applications typically concatenate each list of character strings into a single combined value.

lookupSOA :: Lookup T_soa Source #

SOA RData of query domain.

lookupSRV :: Lookup T_srv Source #

SRV RData of query domain.

lookupTLSA :: Lookup T_tlsa Source #

TLSA RData of query domain.

lookupHTTPS :: Lookup T_https Source #

HTTPS RData of query domain.

Domain names

data Domain where Source #

This type holds the wire form of fully-qualified DNS domain names encoded as A-labels.

The encoding of valid domain names to presentation form (the Presentable instance) performs any required escaping of special characters to ensure lossless round-trip encoding and decoding of valid DNS names, and compatibility with the standard zone file format. Valid names are not limited to the letter-digit-hyphen (LDH) syntax of hostnames, all 8-bit characters are allowed in DNS names, subject to the 63-byte limit on wire form label length and 255-byte limit on the wire form domain name (including the terminal empty label).

Equality and comparison are based on the wire-form and are case-sensitive. The Host newtype implements case-insensitive equality and comparison over the same wire-form bytes. The toHost and fromHost functions implement coercions between the two types.

Bundled Patterns

pattern RootDomain :: Domain

The root Domain (presentation form .).

Instances

Instances details
Presentable Domain Source #

Conversion to presentation form via a bytestring Builder.

Instance details

Defined in Net.DNSBase.Internal.Domain

Show Domain Source #

Shows the presentation form string, adding double quotes and additional string escapes as needed. To get the raw string, use presentString.

Instance details

Defined in Net.DNSBase.Internal.Domain

Eq Domain Source # 
Instance details

Defined in Net.DNSBase.Internal.Domain

Methods

(==) :: Domain -> Domain -> Bool #

(/=) :: Domain -> Domain -> Bool #

Ord Domain Source # 
Instance details

Defined in Net.DNSBase.Internal.Domain

Lift Domain Source # 
Instance details

Defined in Net.DNSBase.Internal.Domain

Methods

lift :: Quote m => Domain -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => Domain -> Code m Domain #

dnLit Source #

Arguments

:: forall e (m :: Type -> Type). (Show e, MonadFail m, Quote m) 
=> (Text -> Either e ShortByteString)

Parser

-> String

Input literal (source code shape)

-> Code m Domain 

Template-Haskell typed splice for a compile-time Domain literal. The caller supplies a parser of type Text -> Either e ShortByteString; dnLit packs the source String literal as Text, runs the parser at compile time, additionally checks the bytes via wireToDomain, and embeds the resulting Domain as a constant. An invalid literal (parser failure or wire-shape failure) becomes a compile-time error.

The dnsbase library deliberately does not bundle a domain parser; users compose a parser of their choice and pass it in. The natural source of validating parsers is the idna2008 package, whose parsers already operate on Text. Template-Haskell staging forbids referring to a same-module top-level binding from inside the splice, so the parser must either be defined in an imported module or bound by a let inside the splice; for a single-call site the latter is the more compact form:

import qualified Text.IDNA2008 as I

example :: Domain
example = $$(let parser = fmap I.wireBytesShort . I.mkDomain
              in dnLit parser "www.example.org")

mkDomain runs strict IDNA2008 with default label forms and no mappings, returning just the validated idna2008 library's Domain object. The I.wireBytesShort function extracts the wire form bytes needed by dnLit.

For looser policies (mappings, emoji domain tolerance, etc.) use parseDomainOpt with an explicit LabelFormSet and IDNAOpts, and discard the LabelInfo half of its result.

Hoisting the parser into a separate module avoids retyping the composition at every literal:

-- in MyDomainParsers.hs
strictParser :: Text -> Either I.IdnaError ShortByteString
strictParser = fmap I.wireBytesShort . I.mkDomain

-- in any module that imports MyDomainParsers
example :: Domain
example = $$(dnLit strictParser "www.example.org")

The source literal is converted to Text before the parser is invoked; literals whose UTF-8 byte length exceeds 1024 are rejected as invalid without consulting the parser. The emitted splice is a constant Domain value (the wire-form ShortByteString is materialised once from its compile-time Addr# literal on first evaluation); the splice itself runs no runtime IDNA code, and the caller's binary carries no idna2008 dependency unless the user imports it themselves.

decodePresentationDomain Source #

Arguments

:: (Text -> Either e ShortByteString)

Parser

-> Text

Input to be parsed

-> Either (Maybe e) Domain 

Decode a domain in presentation form. The caller supplies the parser; this entry point validates the parser's output as a wire-form ShortByteString that wireToDomain accepts.

When the parser returns an error e, the return value is Left (Just e). If a buggy parser produces an invalid wire form, the return value is Left Nothing.

dnLit8 :: forall (m :: Type -> Type). (Quote m, MonadFail m) => String -> Code m Domain Source #

Template-Haskell splice for literal Domain names that are validated and converted from presentation form to wire form at compile-time. Example:

domain :: Domain
domain = $$(dnLit8 "example.org")

This is the byte-level path: it accepts any 8-bit master-file text but performs no IDN processing. For IDN-aware literals (RFC 5890+, Punycode A-label encoding) use dnLit with a parser from the companion idna2008 package.

makeDomain8 :: ByteString -> Either Domain8Err Domain Source #

Construct a Domain object directly from a presentation form ByteString.

The bytes are not treated as UTF-8 content, and IDNA processing does not apply. Backslash-escape encoding aside, each 8-bit byte in the input is copied verbatim into the wire-form domain. For Unicode IDN domain support, see the parsers in the idna2008 package.

Example

Expand
>>> import qualified Data.ByteString.Char8 as BC
>>> dn = makeDomain8 $ BC.pack "www.corp.acme.example"
>>> dn
Right "www.corp.acme.example."
>>> toLabels <$> dn
Right ["www","corp","acme","example"]

makeDomain8Str :: String -> Either Domain8Err Domain Source #

Same as makeDomain8, but the input is a String, and an error (Left) is also returned if any of the input string's characters are outside the 8-bit range.

Note that UTF-8 encoding of names in the Latin-1 alphabet might still produce surprising results. For parsing IDN domain names, see the idna2008 package.

Example

Expand
>>> dn = makeDomain8Str "www.corp.acme.example"
>>> dn
Right "www.corp.acme.example."
>>> toLabels <$> dn
Right ["www","corp","acme","example"]

shortBytes :: Domain -> ShortByteString Source #

The wire form of a domain name, including the zero-valued length byte of the terminal empty label.

wireToDomain :: ShortByteString -> Maybe Domain Source #

Validating import of a wire-form ShortByteString as a Domain. Returns Just iff the bytes are a well-formed DNS domain on the wire:

  • total length in 1..255,
  • every label length byte in 1..63 except the trailing zero-byte root label,
  • label boundaries align exactly with the buffer end -- i.e. the terminating empty label's NUL length-byte is the last byte, and there is no truncation or trailing garbage.

Suitable for receiving bytes the caller cannot prove well-formed (e.g. labels handed back by a foreign library or another package). Wire-form bytes that come straight from the decoder in Net.DNSBase.Decode.Domain are already validated and do not need to round-trip through this check.

Resource records, RData, and messages

data RR Source #

DNS Resource Record RFC1035 3.2.1

                                1  1  1  1  1  1
  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                                               |
/                                               /
/                      NAME                     /
|                                               |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                      TYPE                     |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                     CLASS                     |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                      TTL                      |
|                                               |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                   RDLENGTH                    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
/                     RDATA                     /
/                                               /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

The TYPE field is implicit in the polymorphic rrData.

Constructors

RR 

Instances

Instances details
Presentable RR Source # 
Instance details

Defined in Net.DNSBase.Internal.RR

Show RR Source # 
Instance details

Defined in Net.DNSBase.Internal.RR

Methods

showsPrec :: Int -> RR -> ShowS #

show :: RR -> String #

showList :: [RR] -> ShowS #

Eq RR Source # 
Instance details

Defined in Net.DNSBase.Internal.RR

Methods

(==) :: RR -> RR -> Bool #

(/=) :: RR -> RR -> Bool #

data DnsTriple Source #

An RRSet is uniquely idenfified by a name, type, class triple.

Instances

Instances details
Presentable DnsTriple Source # 
Instance details

Defined in Net.DNSBase.Internal.Domain

Show DnsTriple Source # 
Instance details

Defined in Net.DNSBase.Internal.Domain

Eq DnsTriple Source # 
Instance details

Defined in Net.DNSBase.Internal.Domain

data RData Source #

Wrapper around any concrete KnownRData type.

Its presentation form includes both the type and the value, space-separated. The underlying concrete types present just their values.

Instances

Instances details
Presentable RData Source #

Presents the type and value, space-separated.

Instance details

Defined in Net.DNSBase.Internal.RData

Show RData Source # 
Instance details

Defined in Net.DNSBase.Internal.RData

Methods

showsPrec :: Int -> RData -> ShowS #

show :: RData -> String #

showList :: [RData] -> ShowS #

Eq RData Source # 
Instance details

Defined in Net.DNSBase.Internal.RData

Methods

(==) :: RData -> RData -> Bool #

(/=) :: RData -> RData -> Bool #

Ord RData Source #

Compare RData first by RRtype number, then by content. When two RRtype numbers match, but the data types nevertheless differ, order opaque type after non-opaque. In the unlikely case of two non-opaque types with the same RRtype, compare their opaque encodings (this could throw an error if one of the objects is not encodable, perhaps because encoding would be too long).

Instance details

Defined in Net.DNSBase.Internal.RData

Methods

compare :: RData -> RData -> Ordering #

(<) :: RData -> RData -> Bool #

(<=) :: RData -> RData -> Bool #

(>) :: RData -> RData -> Bool #

(>=) :: RData -> RData -> Bool #

max :: RData -> RData -> RData #

min :: RData -> RData -> RData #

fromRData :: KnownRData a => RData -> Maybe a Source #

Recover a typed RR payload from the existential RData wrapper. Returns Just x when the dynamic payload's type matches the caller's expected type a, and Nothing otherwise.

The target type is selected by the result-side pattern; once there's a concrete constructor on the Just side, the KnownRData a constraint is resolved without an explicit type ascription. A typical use is a view-pattern dispatch that handles two or more RR types at once:

evalIP :: (IP -> a) -> RData -> Maybe a
evalIP f (fromRData -> Just (T_A    ip)) = Just $! f (IPv4 ip)
evalIP f (fromRData -> Just (T_AAAA ip)) = Just $! f (IPv6 ip)
evalIP _ _                               = Nothing

fromRData is the right tool when the value in hand is already an RData. If you instead have an RR (or a list of them, as returned by lookupAnswers), rrDataCast is the convenience composition fromRData . rrData. And monoRData performs the filter-and-cast over a Foldable container in one step.

data RRTYPE Source #

DNS Resource Record type numbers. The Presentable instance displays the standard presentation form of the type name for known types, or else TYPEnnnnn for a generic type number nnnnn.

Instances

Instances details
Presentable RRTYPE Source # 
Instance details

Defined in Net.DNSBase.Internal.RRTYPE

Bounded RRTYPE Source # 
Instance details

Defined in Net.DNSBase.Internal.RRTYPE

Enum RRTYPE Source # 
Instance details

Defined in Net.DNSBase.Internal.RRTYPE

Num RRTYPE Source # 
Instance details

Defined in Net.DNSBase.Internal.RRTYPE

Read RRTYPE Source # 
Instance details

Defined in Net.DNSBase.Internal.RRTYPE

Integral RRTYPE Source # 
Instance details

Defined in Net.DNSBase.Internal.RRTYPE

Real RRTYPE Source # 
Instance details

Defined in Net.DNSBase.Internal.RRTYPE

Show RRTYPE Source # 
Instance details

Defined in Net.DNSBase.Internal.RRTYPE

Eq RRTYPE Source # 
Instance details

Defined in Net.DNSBase.Internal.RRTYPE

Methods

(==) :: RRTYPE -> RRTYPE -> Bool #

(/=) :: RRTYPE -> RRTYPE -> Bool #

Ord RRTYPE Source # 
Instance details

Defined in Net.DNSBase.Internal.RRTYPE

data RRCLASS Source #

DNS query or resource record class.

Instances

Instances details
Presentable RRCLASS Source # 
Instance details

Defined in Net.DNSBase.Internal.RRCLASS

Bounded RRCLASS Source # 
Instance details

Defined in Net.DNSBase.Internal.RRCLASS

Enum RRCLASS Source # 
Instance details

Defined in Net.DNSBase.Internal.RRCLASS

Num RRCLASS Source # 
Instance details

Defined in Net.DNSBase.Internal.RRCLASS

Read RRCLASS Source # 
Instance details

Defined in Net.DNSBase.Internal.RRCLASS

Integral RRCLASS Source # 
Instance details

Defined in Net.DNSBase.Internal.RRCLASS

Real RRCLASS Source # 
Instance details

Defined in Net.DNSBase.Internal.RRCLASS

Show RRCLASS Source # 
Instance details

Defined in Net.DNSBase.Internal.RRCLASS

Eq RRCLASS Source # 
Instance details

Defined in Net.DNSBase.Internal.RRCLASS

Methods

(==) :: RRCLASS -> RRCLASS -> Bool #

(/=) :: RRCLASS -> RRCLASS -> Bool #

Ord RRCLASS Source # 
Instance details

Defined in Net.DNSBase.Internal.RRCLASS

data DNSMessage Source #

DNS query or response header, here consisting of just the query ID and the flags, sans the record counts, which are implicit in the corresponding lists, RFC1035 4.1.1, updated by RFC2535.

The basic DNS header contains the following fields:

                                1  1  1  1  1  1
  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                      ID                       |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|QR|   Opcode  |AA|TC|RD|RA| Z|AD|CD|   RCODE   |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                    QDCOUNT                    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                    ANCOUNT                    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                    NSCOUNT                    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                    ARCOUNT                    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

The basic 4-bit RCODE is augmented with 8 bits from the EDNS header, forming a single extended 12-bit RCODE, with the basic RCODE as its least-significant 4 bits. Similarly, the extended 32-bit DNSFlags are a combination of the basic flags above with 16 more flag bits from the EDNS header, with the basic flags in the low 16-bits (with the Opcode and RCODE bits always cleared).

DNS message format for queries and replies, RFC1035 4.1

 +---------------------+
 |        Header       |
 +---------------------+
 |       Question      | the question for the name server
 +---------------------+
 |        Answer       | RRs answering the question
 +---------------------+
 |      Authority      | RRs pointing toward an authority
 +---------------------+
 |      Additional     | RRs holding additional information
 +---------------------+

Instances

Instances details
Show DNSMessage Source # 
Instance details

Defined in Net.DNSBase.Internal.Message

Eq DNSMessage Source # 
Instance details

Defined in Net.DNSBase.Internal.Message

data DNSError Source #

DNS API errors.

Constructors

BadConfiguration String

Resolver misconfiguration.

BadNameserver IOException

Nameserver name -> address lookup failure.

DecodeError DecodeContext String

Error while decoding from wire form.

EncodeError EncodeContext

Error while encoding to wire form.

InvalidDomain String

Invalid domain name presentation form.

NetworkError NetworkContext

Error in connection establishment, data transmission or a timeout.

ProtocolError ProtocolContext

Unexpected DNS message.

ResponseError RCODE

DNS message indicates a remote error condition.

UserError UserContext

Invalid request.

Common resource record types

newtype T_a Source #

The A resource record (RFC 1035 section 3.4.1) — a 32-bit IPv4 address transmitted as four bytes in network order. The derived Ord is numeric IPv4 order, which agrees with canonical RR-content ordering (RFC 4034 section 6.2).

See T_aaaa for the IPv6-family parallel, and evalIP for a helper that handles either uniformly.

Constructors

T_A IPv4

IPv4 address

Instances

Instances details
Presentable T_a Source # 
Instance details

Defined in Net.DNSBase.RData.A

KnownRData T_a Source # 
Instance details

Defined in Net.DNSBase.RData.A

Associated Types

type RDataExtensionVal T_a 
Instance details

Defined in Net.DNSBase.RData.A

Methods

rdataExtensionVal :: forall b -> b ~ T_a => RDataExtensionVal T_a Source #

rdType :: forall b -> b ~ T_a => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_a => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_a => RDataExtensionVal T_a -> Int -> SGet RData Source #

rdEncode :: T_a -> SPut s RData Source #

cnEncode :: T_a -> SPut s RData Source #

Enum T_a Source # 
Instance details

Defined in Net.DNSBase.RData.A

Methods

succ :: T_a -> T_a #

pred :: T_a -> T_a #

toEnum :: Int -> T_a #

fromEnum :: T_a -> Int #

enumFrom :: T_a -> [T_a] #

enumFromThen :: T_a -> T_a -> [T_a] #

enumFromTo :: T_a -> T_a -> [T_a] #

enumFromThenTo :: T_a -> T_a -> T_a -> [T_a] #

Show T_a Source # 
Instance details

Defined in Net.DNSBase.RData.A

Methods

showsPrec :: Int -> T_a -> ShowS #

show :: T_a -> String #

showList :: [T_a] -> ShowS #

Eq T_a Source # 
Instance details

Defined in Net.DNSBase.RData.A

Methods

(==) :: T_a -> T_a -> Bool #

(/=) :: T_a -> T_a -> Bool #

Ord T_a Source # 
Instance details

Defined in Net.DNSBase.RData.A

Methods

compare :: T_a -> T_a -> Ordering #

(<) :: T_a -> T_a -> Bool #

(<=) :: T_a -> T_a -> Bool #

(>) :: T_a -> T_a -> Bool #

(>=) :: T_a -> T_a -> Bool #

max :: T_a -> T_a -> T_a #

min :: T_a -> T_a -> T_a #

type RDataExtensionVal T_a Source # 
Instance details

Defined in Net.DNSBase.RData.A

newtype T_aaaa Source #

The AAAA resource record (RFC 3596 section 2.1) — a 128-bit IPv6 address transmitted as sixteen bytes in network order. The derived Ord is numeric IPv6 order, which agrees with canonical RR-content ordering (RFC 4034 section 6.2).

See T_a for the IPv4-family parallel, and evalIP for a helper that handles either uniformly.

Constructors

T_AAAA IPv6

IPv6 address

Instances

Instances details
Presentable T_aaaa Source # 
Instance details

Defined in Net.DNSBase.RData.A

KnownRData T_aaaa Source # 
Instance details

Defined in Net.DNSBase.RData.A

Associated Types

type RDataExtensionVal T_aaaa 
Instance details

Defined in Net.DNSBase.RData.A

Show T_aaaa Source # 
Instance details

Defined in Net.DNSBase.RData.A

Eq T_aaaa Source # 
Instance details

Defined in Net.DNSBase.RData.A

Methods

(==) :: T_aaaa -> T_aaaa -> Bool #

(/=) :: T_aaaa -> T_aaaa -> Bool #

Ord T_aaaa Source # 
Instance details

Defined in Net.DNSBase.RData.A

type RDataExtensionVal T_aaaa Source # 
Instance details

Defined in Net.DNSBase.RData.A

data T_mx Source #

The MX resource record (RFC 1035 section 3.3.9) — a mail exchanger for the owner name: a 16-bit preference (lower is preferred) and a Domain naming the exchange host.

 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 |                  PREFERENCE                   |
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
 /                   EXCHANGE                    /
 /                                               /
 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

The exchange field is subject to wire-form name compression on encode (RFC 3597 section 4) and canonicalises to lower case (RFC 4034 section 6.2). The Eq and Ord instances compare the exchange in canonical wire form (via equalWireHost / compareWireHost), so Ord is canonical.

A name that resolves to a CNAME should not be used in the exchange field (RFC 2181 section 10.3, RFC 5321 section 5.1).

Constructors

T_MX 

Fields

Instances

Instances details
Presentable T_mx Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

KnownRData T_mx Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Associated Types

type RDataExtensionVal T_mx 
Instance details

Defined in Net.DNSBase.RData.SRV

Methods

rdataExtensionVal :: forall b -> b ~ T_mx => RDataExtensionVal T_mx Source #

rdType :: forall b -> b ~ T_mx => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_mx => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_mx => RDataExtensionVal T_mx -> Int -> SGet RData Source #

rdEncode :: T_mx -> SPut s RData Source #

cnEncode :: T_mx -> SPut s RData Source #

Show T_mx Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Methods

showsPrec :: Int -> T_mx -> ShowS #

show :: T_mx -> String #

showList :: [T_mx] -> ShowS #

Eq T_mx Source #

Case-insensitive wire-form equality.

Instance details

Defined in Net.DNSBase.RData.SRV

Methods

(==) :: T_mx -> T_mx -> Bool #

(/=) :: T_mx -> T_mx -> Bool #

Ord T_mx Source #

Case-insensitive wire-form order.

Instance details

Defined in Net.DNSBase.RData.SRV

Methods

compare :: T_mx -> T_mx -> Ordering #

(<) :: T_mx -> T_mx -> Bool #

(<=) :: T_mx -> T_mx -> Bool #

(>) :: T_mx -> T_mx -> Bool #

(>=) :: T_mx -> T_mx -> Bool #

max :: T_mx -> T_mx -> T_mx #

min :: T_mx -> T_mx -> T_mx #

type RDataExtensionVal T_mx Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

data T_srv Source #

The SRV resource record (RFC 2782) — names the location of a service: 16-bit priority, weight, and port, plus a Domain naming the target host.

The target field is not subject to wire-form name compression on encode (RFC 3597 section 4) but compression is tolerated on decode. It canonicalises to lower case (RFC 4034 section 6.2). The Eq and Ord instances compare the target in canonical wire form (via equalWireHost / compareWireHost), so Ord is canonical.

Constructors

T_SRV 

Instances

Instances details
Presentable T_srv Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

KnownRData T_srv Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Associated Types

type RDataExtensionVal T_srv 
Instance details

Defined in Net.DNSBase.RData.SRV

Methods

rdataExtensionVal :: forall b -> b ~ T_srv => RDataExtensionVal T_srv Source #

rdType :: forall b -> b ~ T_srv => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_srv => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_srv => RDataExtensionVal T_srv -> Int -> SGet RData Source #

rdEncode :: T_srv -> SPut s RData Source #

cnEncode :: T_srv -> SPut s RData Source #

Show T_srv Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Methods

showsPrec :: Int -> T_srv -> ShowS #

show :: T_srv -> String #

showList :: [T_srv] -> ShowS #

Eq T_srv Source #

Equality is not case-senstive on the target host name.

Instance details

Defined in Net.DNSBase.RData.SRV

Methods

(==) :: T_srv -> T_srv -> Bool #

(/=) :: T_srv -> T_srv -> Bool #

Ord T_srv Source #

Order is not case-senstive on the target host name.

Instance details

Defined in Net.DNSBase.RData.SRV

Methods

compare :: T_srv -> T_srv -> Ordering #

(<) :: T_srv -> T_srv -> Bool #

(<=) :: T_srv -> T_srv -> Bool #

(>) :: T_srv -> T_srv -> Bool #

(>=) :: T_srv -> T_srv -> Bool #

max :: T_srv -> T_srv -> T_srv #

min :: T_srv -> T_srv -> T_srv #

type RDataExtensionVal T_srv Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

newtype T_txt Source #

The TXT resource record (RFC 1035 section 3.3.14) — a non-empty list of byte-strings, each at most 255 bytes long. Most TXT-record conventions (SPF, DKIM, DMARC, ...) concatenate the strings on read, but the wire format preserves the boundaries.

The constructor does not enforce the per-string 255-byte limit; encoding fails if any individual string exceeds it. Values decoded from wire form are always within the limit by construction.

The Ord instance compares the strings as DNS character-strings (length-prefixed lexicographic), agreeing with the canonical wire-form ordering of RFC 4034 section 6.2.

Constructors

T_TXT (NonEmpty ShortByteString)

One or more character-strings

Instances

Instances details
Presentable T_txt Source # 
Instance details

Defined in Net.DNSBase.RData.TXT

KnownRData T_txt Source # 
Instance details

Defined in Net.DNSBase.RData.TXT

Associated Types

type RDataExtensionVal T_txt 
Instance details

Defined in Net.DNSBase.RData.TXT

Methods

rdataExtensionVal :: forall b -> b ~ T_txt => RDataExtensionVal T_txt Source #

rdType :: forall b -> b ~ T_txt => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_txt => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_txt => RDataExtensionVal T_txt -> Int -> SGet RData Source #

rdEncode :: T_txt -> SPut s RData Source #

cnEncode :: T_txt -> SPut s RData Source #

Show T_txt Source # 
Instance details

Defined in Net.DNSBase.RData.TXT

Methods

showsPrec :: Int -> T_txt -> ShowS #

show :: T_txt -> String #

showList :: [T_txt] -> ShowS #

Eq T_txt Source # 
Instance details

Defined in Net.DNSBase.RData.TXT

Methods

(==) :: T_txt -> T_txt -> Bool #

(/=) :: T_txt -> T_txt -> Bool #

Ord T_txt Source # 
Instance details

Defined in Net.DNSBase.RData.TXT

Methods

compare :: T_txt -> T_txt -> Ordering #

(<) :: T_txt -> T_txt -> Bool #

(<=) :: T_txt -> T_txt -> Bool #

(>) :: T_txt -> T_txt -> Bool #

(>=) :: T_txt -> T_txt -> Bool #

max :: T_txt -> T_txt -> T_txt #

min :: T_txt -> T_txt -> T_txt #

type RDataExtensionVal T_txt Source # 
Instance details

Defined in Net.DNSBase.RData.TXT

type T_ptr = X_domain N_ptr Source #

X_domain specialised to PTR records.

pattern T_PTR :: Domain -> T_ptr Source #

Domain-name pointer, typically used for reverse mapping (RFC 1035 section 3.3.12).

type T_https = X_svcb N_https Source #

X_svcb specialised to HTTPS records.

pattern T_HTTPS Source #

Arguments

:: Word16

SvcPriority

-> Domain

TargetName

-> SPVSet

SvcParams

-> T_https 

Record pattern synonym viewing the shared X_svcb record as an HTTPS service-binding record (RFC 9460). Fields: httpsPriority, httpsTarget, httpsParamValues.

Query and EDNS controls

data QueryControls where Source #

Query controls consisting of an endomorphism over FlagOps to modify DNS flag bits, and an EdnsControls structure to configure EDNS behavior.

Constitutes a Monoid with left-biased mappend operation

Bundled Patterns

pattern QctlFlags

Apply the requested DNS flag operation, setting or clearing the requested flag bits, or restoring defaults.

Fields

pattern EdnsEnabled :: QueryControls

Enable EDNS for this query, overriding the resolver default if it had EDNS disabled. The OPT pseudo-RR is included in the outgoing query.

pattern EdnsDisabled :: QueryControls

Disable EDNS for this query. When EDNS is disabled, the OPT pseudo-RR is omitted from the outgoing query and the other EDNS-related tweaks (EdnsVersion, EdnsUdpSize, EdnsOptionCtl) have no effect on the wire.

pattern EdnsUdpSize

Override the maximum UDP payload size the client advertises to the server for this query. The value is clamped to the minUdpSize / maxUdpSize range.

Fields

pattern EdnsOptionCtl

Carry a per-call modification of the OPT pseudo-RR's EDNS option list as an endomorphism OptionCtl -> OptionCtl. The endomorphism is applied to the resolver's ambient option list at query-build time, so callers express deltas — clear everything, add an option, replace an option — rather than full replacements.

optCtlAdd and optCtlSet are the standard ways to build the endomorphism. For example, to opt out of geolocation-tailored answers for a single query by signalling "do not use my subnet" via ECS with a zero-length source prefix (RFC 7871 section 7.1.2):

let noEcs = EdnsOptionCtl
          $ optCtlAdd [ EdnsOption
                      $ O_ECS 0 0 (IPv4 (toIPv4 [0,0,0,0])) ]
 in lookupAnswers rslv noEcs IN A $$(dnLit8 "example.org")

optCtlAdd replaces the resolver's existing ECS option (if any) with this one because they share an OPTCODE; other options the resolver had configured pass through untouched. optCtlSet would instead clear the entire option list and use only the supplied options.

Fields

pattern RDflag :: DNSFlags Source #

RD (Recursion Desired) - This bit may be set in a query and is copied into the response. If RD is set, it directs the name server to pursue the query recursively. Authoritative servers may refuse recursive queries, and, conversely, iterative resolvers may refuse non-recursive queries.

pattern ADflag :: DNSFlags Source #

AD (Authentic Data) bit - RFC4035, Section 3.2.3. See also RFC6840, Section 5.8

pattern CDflag :: DNSFlags Source #

CD (Checking Disabled) bit - RFC4035, Section 3.2.2.

pattern DOflag :: DNSFlags Source #

DO (DNSSEC OK) bit - RFC3225, Section 3, RFC6891, Section-6.1.4.

Extending the library

class (Typeable a, Eq a, Ord a, Show a, Presentable a) => KnownRData a Source #

Abstract DNS Resource Record (type-specific) data.

The decoding, encoding and presentation functions are responsible for just the value, presentation of the associated RR type defaults to the built-in names, for novel types override rdTypePres.

The Show instance is typically derived, and will output the type constructor (its output strives to produce syntactically valid Haskell values), in contrast with Presentable which produces RFC-standard presentation forms.

Minimal complete definition

rdType, rdDecode, rdEncode

Instances

Instances details
KnownRData T_a Source # 
Instance details

Defined in Net.DNSBase.RData.A

Associated Types

type RDataExtensionVal T_a 
Instance details

Defined in Net.DNSBase.RData.A

Methods

rdataExtensionVal :: forall b -> b ~ T_a => RDataExtensionVal T_a Source #

rdType :: forall b -> b ~ T_a => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_a => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_a => RDataExtensionVal T_a -> Int -> SGet RData Source #

rdEncode :: T_a -> SPut s RData Source #

cnEncode :: T_a -> SPut s RData Source #

KnownRData T_aaaa Source # 
Instance details

Defined in Net.DNSBase.RData.A

Associated Types

type RDataExtensionVal T_aaaa 
Instance details

Defined in Net.DNSBase.RData.A

KnownRData T_caa Source # 
Instance details

Defined in Net.DNSBase.RData.CAA

Associated Types

type RDataExtensionVal T_caa 
Instance details

Defined in Net.DNSBase.RData.CAA

Methods

rdataExtensionVal :: forall b -> b ~ T_caa => RDataExtensionVal T_caa Source #

rdType :: forall b -> b ~ T_caa => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_caa => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_caa => RDataExtensionVal T_caa -> Int -> SGet RData Source #

rdEncode :: T_caa -> SPut s RData Source #

cnEncode :: T_caa -> SPut s RData Source #

KnownRData T_csync Source # 
Instance details

Defined in Net.DNSBase.RData.CSYNC

Associated Types

type RDataExtensionVal T_csync 
Instance details

Defined in Net.DNSBase.RData.CSYNC

KnownRData T_dsync Source # 
Instance details

Defined in Net.DNSBase.RData.CSYNC

Associated Types

type RDataExtensionVal T_dsync 
Instance details

Defined in Net.DNSBase.RData.CSYNC

KnownRData T_ipseckey Source # 
Instance details

Defined in Net.DNSBase.RData.Dnssec

Associated Types

type RDataExtensionVal T_ipseckey 
Instance details

Defined in Net.DNSBase.RData.Dnssec

KnownRData T_zonemd Source # 
Instance details

Defined in Net.DNSBase.RData.Dnssec

Associated Types

type RDataExtensionVal T_zonemd 
Instance details

Defined in Net.DNSBase.RData.Dnssec

KnownRData T_dname Source #

Name compression used on input only.

Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Associated Types

type RDataExtensionVal T_dname 
Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

KnownRData T_nsec Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Associated Types

type RDataExtensionVal T_nsec 
Instance details

Defined in Net.DNSBase.RData.NSEC

KnownRData T_nsec3 Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Associated Types

type RDataExtensionVal T_nsec3 
Instance details

Defined in Net.DNSBase.RData.NSEC

KnownRData T_nsec3param Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Associated Types

type RDataExtensionVal T_nsec3param 
Instance details

Defined in Net.DNSBase.RData.NSEC

KnownRData T_nxt Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Associated Types

type RDataExtensionVal T_nxt 
Instance details

Defined in Net.DNSBase.RData.NSEC

Methods

rdataExtensionVal :: forall b -> b ~ T_nxt => RDataExtensionVal T_nxt Source #

rdType :: forall b -> b ~ T_nxt => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_nxt => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_nxt => RDataExtensionVal T_nxt -> Int -> SGet RData Source #

rdEncode :: T_nxt -> SPut s RData Source #

cnEncode :: T_nxt -> SPut s RData Source #

KnownRData T_a6 Source # 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Associated Types

type RDataExtensionVal T_a6 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Methods

rdataExtensionVal :: forall b -> b ~ T_a6 => RDataExtensionVal T_a6 Source #

rdType :: forall b -> b ~ T_a6 => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_a6 => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_a6 => RDataExtensionVal T_a6 -> Int -> SGet RData Source #

rdEncode :: T_a6 -> SPut s RData Source #

cnEncode :: T_a6 -> SPut s RData Source #

KnownRData T_gpos Source # 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Associated Types

type RDataExtensionVal T_gpos 
Instance details

Defined in Net.DNSBase.RData.Obsolete

KnownRData T_isdn Source # 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Associated Types

type RDataExtensionVal T_isdn 
Instance details

Defined in Net.DNSBase.RData.Obsolete

KnownRData T_kx Source # 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Associated Types

type RDataExtensionVal T_kx 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Methods

rdataExtensionVal :: forall b -> b ~ T_kx => RDataExtensionVal T_kx Source #

rdType :: forall b -> b ~ T_kx => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_kx => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_kx => RDataExtensionVal T_kx -> Int -> SGet RData Source #

rdEncode :: T_kx -> SPut s RData Source #

cnEncode :: T_kx -> SPut s RData Source #

KnownRData T_minfo Source # 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Associated Types

type RDataExtensionVal T_minfo 
Instance details

Defined in Net.DNSBase.RData.Obsolete

KnownRData T_nsap Source # 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Associated Types

type RDataExtensionVal T_nsap 
Instance details

Defined in Net.DNSBase.RData.Obsolete

KnownRData T_nsapptr Source # 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Associated Types

type RDataExtensionVal T_nsapptr 
Instance details

Defined in Net.DNSBase.RData.Obsolete

KnownRData T_px Source # 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Associated Types

type RDataExtensionVal T_px 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Methods

rdataExtensionVal :: forall b -> b ~ T_px => RDataExtensionVal T_px Source #

rdType :: forall b -> b ~ T_px => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_px => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_px => RDataExtensionVal T_px -> Int -> SGet RData Source #

rdEncode :: T_px -> SPut s RData Source #

cnEncode :: T_px -> SPut s RData Source #

KnownRData T_rt Source # 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Associated Types

type RDataExtensionVal T_rt 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Methods

rdataExtensionVal :: forall b -> b ~ T_rt => RDataExtensionVal T_rt Source #

rdType :: forall b -> b ~ T_rt => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_rt => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_rt => RDataExtensionVal T_rt -> Int -> SGet RData Source #

rdEncode :: T_rt -> SPut s RData Source #

cnEncode :: T_rt -> SPut s RData Source #

KnownRData T_x25 Source # 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Associated Types

type RDataExtensionVal T_x25 
Instance details

Defined in Net.DNSBase.RData.Obsolete

Methods

rdataExtensionVal :: forall b -> b ~ T_x25 => RDataExtensionVal T_x25 Source #

rdType :: forall b -> b ~ T_x25 => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_x25 => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_x25 => RDataExtensionVal T_x25 -> Int -> SGet RData Source #

rdEncode :: T_x25 -> SPut s RData Source #

cnEncode :: T_x25 -> SPut s RData Source #

KnownRData T_rp Source # 
Instance details

Defined in Net.DNSBase.RData.SOA

Associated Types

type RDataExtensionVal T_rp 
Instance details

Defined in Net.DNSBase.RData.SOA

Methods

rdataExtensionVal :: forall b -> b ~ T_rp => RDataExtensionVal T_rp Source #

rdType :: forall b -> b ~ T_rp => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_rp => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_rp => RDataExtensionVal T_rp -> Int -> SGet RData Source #

rdEncode :: T_rp -> SPut s RData Source #

cnEncode :: T_rp -> SPut s RData Source #

KnownRData T_soa Source # 
Instance details

Defined in Net.DNSBase.RData.SOA

Associated Types

type RDataExtensionVal T_soa 
Instance details

Defined in Net.DNSBase.RData.SOA

Methods

rdataExtensionVal :: forall b -> b ~ T_soa => RDataExtensionVal T_soa Source #

rdType :: forall b -> b ~ T_soa => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_soa => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_soa => RDataExtensionVal T_soa -> Int -> SGet RData Source #

rdEncode :: T_soa -> SPut s RData Source #

cnEncode :: T_soa -> SPut s RData Source #

KnownRData T_afsdb Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Associated Types

type RDataExtensionVal T_afsdb 
Instance details

Defined in Net.DNSBase.RData.SRV

KnownRData T_amtrelay Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Associated Types

type RDataExtensionVal T_amtrelay 
Instance details

Defined in Net.DNSBase.RData.SRV

KnownRData T_l32 Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Associated Types

type RDataExtensionVal T_l32 
Instance details

Defined in Net.DNSBase.RData.SRV

Methods

rdataExtensionVal :: forall b -> b ~ T_l32 => RDataExtensionVal T_l32 Source #

rdType :: forall b -> b ~ T_l32 => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_l32 => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_l32 => RDataExtensionVal T_l32 -> Int -> SGet RData Source #

rdEncode :: T_l32 -> SPut s RData Source #

cnEncode :: T_l32 -> SPut s RData Source #

KnownRData T_lp Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Associated Types

type RDataExtensionVal T_lp 
Instance details

Defined in Net.DNSBase.RData.SRV

Methods

rdataExtensionVal :: forall b -> b ~ T_lp => RDataExtensionVal T_lp Source #

rdType :: forall b -> b ~ T_lp => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_lp => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_lp => RDataExtensionVal T_lp -> Int -> SGet RData Source #

rdEncode :: T_lp -> SPut s RData Source #

cnEncode :: T_lp -> SPut s RData Source #

KnownRData T_mx Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Associated Types

type RDataExtensionVal T_mx 
Instance details

Defined in Net.DNSBase.RData.SRV

Methods

rdataExtensionVal :: forall b -> b ~ T_mx => RDataExtensionVal T_mx Source #

rdType :: forall b -> b ~ T_mx => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_mx => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_mx => RDataExtensionVal T_mx -> Int -> SGet RData Source #

rdEncode :: T_mx -> SPut s RData Source #

cnEncode :: T_mx -> SPut s RData Source #

KnownRData T_naptr Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Associated Types

type RDataExtensionVal T_naptr 
Instance details

Defined in Net.DNSBase.RData.SRV

KnownRData T_srv Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Associated Types

type RDataExtensionVal T_srv 
Instance details

Defined in Net.DNSBase.RData.SRV

Methods

rdataExtensionVal :: forall b -> b ~ T_srv => RDataExtensionVal T_srv Source #

rdType :: forall b -> b ~ T_srv => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_srv => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_srv => RDataExtensionVal T_srv -> Int -> SGet RData Source #

rdEncode :: T_srv -> SPut s RData Source #

cnEncode :: T_srv -> SPut s RData Source #

KnownRData T_openpgpkey Source # 
Instance details

Defined in Net.DNSBase.RData.TLSA

Associated Types

type RDataExtensionVal T_openpgpkey 
Instance details

Defined in Net.DNSBase.RData.TLSA

KnownRData T_sshfp Source # 
Instance details

Defined in Net.DNSBase.RData.TLSA

Associated Types

type RDataExtensionVal T_sshfp 
Instance details

Defined in Net.DNSBase.RData.TLSA

KnownRData T_hinfo Source # 
Instance details

Defined in Net.DNSBase.RData.TXT

Associated Types

type RDataExtensionVal T_hinfo 
Instance details

Defined in Net.DNSBase.RData.TXT

KnownRData T_null Source # 
Instance details

Defined in Net.DNSBase.RData.TXT

Associated Types

type RDataExtensionVal T_null 
Instance details

Defined in Net.DNSBase.RData.TXT

KnownRData T_txt Source # 
Instance details

Defined in Net.DNSBase.RData.TXT

Associated Types

type RDataExtensionVal T_txt 
Instance details

Defined in Net.DNSBase.RData.TXT

Methods

rdataExtensionVal :: forall b -> b ~ T_txt => RDataExtensionVal T_txt Source #

rdType :: forall b -> b ~ T_txt => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_txt => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_txt => RDataExtensionVal T_txt -> Int -> SGet RData Source #

rdEncode :: T_txt -> SPut s RData Source #

cnEncode :: T_txt -> SPut s RData Source #

KnownRData T_wks Source # 
Instance details

Defined in Net.DNSBase.RData.WKS

Associated Types

type RDataExtensionVal T_wks 
Instance details

Defined in Net.DNSBase.RData.WKS

Methods

rdataExtensionVal :: forall b -> b ~ T_wks => RDataExtensionVal T_wks Source #

rdType :: forall b -> b ~ T_wks => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_wks => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_wks => RDataExtensionVal T_wks -> Int -> SGet RData Source #

rdEncode :: T_wks -> SPut s RData Source #

cnEncode :: T_wks -> SPut s RData Source #

Nat16 n => KnownRData (OpaqueRData n) Source # 
Instance details

Defined in Net.DNSBase.Internal.RData

Associated Types

type RDataExtensionVal (OpaqueRData n) 
Instance details

Defined in Net.DNSBase.Internal.RData

(Nat16 n, KnownSymbol (XdsConName n)) => KnownRData (X_ds n) Source # 
Instance details

Defined in Net.DNSBase.RData.Dnssec

Associated Types

type RDataExtensionVal (X_ds n) 
Instance details

Defined in Net.DNSBase.RData.Dnssec

type RDataExtensionVal (X_ds n) = ()

Methods

rdataExtensionVal :: forall b -> b ~ X_ds n => RDataExtensionVal (X_ds n) Source #

rdType :: forall b -> b ~ X_ds n => RRTYPE Source #

rdTypePres :: forall b -> b ~ X_ds n => Builder -> Builder Source #

rdDecode :: forall b -> b ~ X_ds n => RDataExtensionVal (X_ds n) -> Int -> SGet RData Source #

rdEncode :: X_ds n -> SPut s RData Source #

cnEncode :: X_ds n -> SPut s RData Source #

(Nat16 n, KnownSymbol (XkeyConName n)) => KnownRData (X_key n) Source # 
Instance details

Defined in Net.DNSBase.RData.Dnssec

Associated Types

type RDataExtensionVal (X_key n) 
Instance details

Defined in Net.DNSBase.RData.Dnssec

type RDataExtensionVal (X_key n) = ()

Methods

rdataExtensionVal :: forall b -> b ~ X_key n => RDataExtensionVal (X_key n) Source #

rdType :: forall b -> b ~ X_key n => RRTYPE Source #

rdTypePres :: forall b -> b ~ X_key n => Builder -> Builder Source #

rdDecode :: forall b -> b ~ X_key n => RDataExtensionVal (X_key n) -> Int -> SGet RData Source #

rdEncode :: X_key n -> SPut s RData Source #

cnEncode :: X_key n -> SPut s RData Source #

(Nat16 n, KnownSymbol (XsigConName n)) => KnownRData (X_sig n) Source # 
Instance details

Defined in Net.DNSBase.RData.Dnssec

Associated Types

type RDataExtensionVal (X_sig n) 
Instance details

Defined in Net.DNSBase.RData.Dnssec

type RDataExtensionVal (X_sig n) = ()

Methods

rdataExtensionVal :: forall b -> b ~ X_sig n => RDataExtensionVal (X_sig n) Source #

rdType :: forall b -> b ~ X_sig n => RRTYPE Source #

rdTypePres :: forall b -> b ~ X_sig n => Builder -> Builder Source #

rdDecode :: forall b -> b ~ X_sig n => RDataExtensionVal (X_sig n) -> Int -> SGet RData Source #

rdEncode :: X_sig n -> SPut s RData Source #

cnEncode :: X_sig n -> SPut s RData Source #

(Typeable n, Nat16 n, KnownSymbol (XdomainConName n)) => KnownRData (X_domain n) Source #

Name compression used on input and output.

Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Associated Types

type RDataExtensionVal (X_domain n) 
Instance details

Defined in Net.DNSBase.RData.Internal.XNAME

Methods

rdataExtensionVal :: forall b -> b ~ X_domain n => RDataExtensionVal (X_domain n) Source #

rdType :: forall b -> b ~ X_domain n => RRTYPE Source #

rdTypePres :: forall b -> b ~ X_domain n => Builder -> Builder Source #

rdDecode :: forall b -> b ~ X_domain n => RDataExtensionVal (X_domain n) -> Int -> SGet RData Source #

rdEncode :: X_domain n -> SPut s RData Source #

cnEncode :: X_domain n -> SPut s RData Source #

(Nat16 n, KnownSymbol (XnidConName n)) => KnownRData (X_nid n) Source # 
Instance details

Defined in Net.DNSBase.RData.SRV

Associated Types

type RDataExtensionVal (X_nid n) 
Instance details

Defined in Net.DNSBase.RData.SRV

type RDataExtensionVal (X_nid n) = ()

Methods

rdataExtensionVal :: forall b -> b ~ X_nid n => RDataExtensionVal (X_nid n) Source #

rdType :: forall b -> b ~ X_nid n => RRTYPE Source #

rdTypePres :: forall b -> b ~ X_nid n => Builder -> Builder Source #

rdDecode :: forall b -> b ~ X_nid n => RDataExtensionVal (X_nid n) -> Int -> SGet RData Source #

rdEncode :: X_nid n -> SPut s RData Source #

cnEncode :: X_nid n -> SPut s RData Source #

(Nat16 n, KnownSymbol (XsvcbConName n)) => KnownRData (X_svcb n) Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB

Associated Types

type RDataExtensionVal (X_svcb n) 
Instance details

Defined in Net.DNSBase.RData.SVCB

Methods

rdataExtensionVal :: forall b -> b ~ X_svcb n => RDataExtensionVal (X_svcb n) Source #

rdType :: forall b -> b ~ X_svcb n => RRTYPE Source #

rdTypePres :: forall b -> b ~ X_svcb n => Builder -> Builder Source #

rdDecode :: forall b -> b ~ X_svcb n => RDataExtensionVal (X_svcb n) -> Int -> SGet RData Source #

rdEncode :: X_svcb n -> SPut s RData Source #

cnEncode :: X_svcb n -> SPut s RData Source #

(Nat16 n, KnownSymbol (XtlsaConName n)) => KnownRData (X_tlsa n) Source # 
Instance details

Defined in Net.DNSBase.RData.TLSA

Associated Types

type RDataExtensionVal (X_tlsa n) 
Instance details

Defined in Net.DNSBase.RData.TLSA

Methods

rdataExtensionVal :: forall b -> b ~ X_tlsa n => RDataExtensionVal (X_tlsa n) Source #

rdType :: forall b -> b ~ X_tlsa n => RRTYPE Source #

rdTypePres :: forall b -> b ~ X_tlsa n => Builder -> Builder Source #

rdDecode :: forall b -> b ~ X_tlsa n => RDataExtensionVal (X_tlsa n) -> Int -> SGet RData Source #

rdEncode :: X_tlsa n -> SPut s RData Source #

cnEncode :: X_tlsa n -> SPut s RData Source #

registerRRtype :: forall a -> KnownRData a => ResolverConf -> ResolverConf Source #

Register a decoder for an RR-type. If the RR's data type is itself extensible, you can use extendRRwithType or extendRRwithValue to apply additional extensions on top.

The registration takes precedence over the library's built-in codec at the same RR-type code, except at protected code points (e.g. RR-type 0 and 65535, or the OPT pseudo-RR), where the registration is silently ignored.

extendRRwithType :: forall t -> (KnownRData t, TypeExtensible t (RDataExtensionVal t)) => forall b -> TypeExtensionArg t b => ResolverConf -> ResolverConf Source #

Extend the registered codec of a type-extensible RR type t with an additional typed extension b. If t is not yet known it is automatically registered, in either case extendByType is then applied to the existing decoder state to fold in b.

This is how one adds an extra SvcParam-key decoder for SVCB and/or HTTPS records.

conf
    & extendRRwithType T_svcb  MyParamType
    & extendRRwithType T_https MyParamType

extendRRwithValue :: forall t -> (KnownRData t, ValueExtensible t (RDataExtensionVal t)) => forall b. ValueExtensionArg t b => b -> ResolverConf -> ResolverConf Source #

Extend the registered codec for RR type t with a caller-supplied value v, whose type satisfies t's ValueExtensionArg constraint. Parallel to extendRRwithType, but for instances whose extension table is keyed by runtime data rather than user-supplied types.

class (Typeable a, Eq a, Show a, Presentable a) => KnownEdnsOption a Source #

EDNS option class with conversion to/from opaque EdnsOption form.

Minimal complete definition

optNum, optEncode, optDecode

Instances

Instances details
KnownEdnsOption O_ecs Source # 
Instance details

Defined in Net.DNSBase.EDNS.Option.ECS

Associated Types

type OptionExtensionVal O_ecs 
Instance details

Defined in Net.DNSBase.EDNS.Option.ECS

Methods

optionExtensionVal :: forall b -> b ~ O_ecs => OptionExtensionVal O_ecs Source #

optNum :: forall b -> b ~ O_ecs => OptNum Source #

optPres :: forall b -> b ~ O_ecs => Builder -> Builder Source #

optEncode :: forall s r. (Typeable r, Eq r, Show r) => O_ecs -> SPut s r Source #

optDecode :: forall b -> b ~ O_ecs => OptionExtensionVal b -> Int -> SGet EdnsOption Source #

KnownEdnsOption O_ede Source # 
Instance details

Defined in Net.DNSBase.EDNS.Option.EDE

Associated Types

type OptionExtensionVal O_ede 
Instance details

Defined in Net.DNSBase.EDNS.Option.EDE

Methods

optionExtensionVal :: forall b -> b ~ O_ede => OptionExtensionVal O_ede Source #

optNum :: forall b -> b ~ O_ede => OptNum Source #

optPres :: forall b -> b ~ O_ede => Builder -> Builder Source #

optEncode :: forall s r. (Typeable r, Eq r, Show r) => O_ede -> SPut s r Source #

optDecode :: forall b -> b ~ O_ede => OptionExtensionVal b -> Int -> SGet EdnsOption Source #

KnownEdnsOption O_nsid Source # 
Instance details

Defined in Net.DNSBase.EDNS.Option.NSID

Associated Types

type OptionExtensionVal O_nsid 
Instance details

Defined in Net.DNSBase.EDNS.Option.NSID

Methods

optionExtensionVal :: forall b -> b ~ O_nsid => OptionExtensionVal O_nsid Source #

optNum :: forall b -> b ~ O_nsid => OptNum Source #

optPres :: forall b -> b ~ O_nsid => Builder -> Builder Source #

optEncode :: forall s r. (Typeable r, Eq r, Show r) => O_nsid -> SPut s r Source #

optDecode :: forall b -> b ~ O_nsid => OptionExtensionVal b -> Int -> SGet EdnsOption Source #

KnownEdnsOption O_dau Source # 
Instance details

Defined in Net.DNSBase.EDNS.Option.Secalgs

Associated Types

type OptionExtensionVal O_dau 
Instance details

Defined in Net.DNSBase.EDNS.Option.Secalgs

Methods

optionExtensionVal :: forall b -> b ~ O_dau => OptionExtensionVal O_dau Source #

optNum :: forall b -> b ~ O_dau => OptNum Source #

optPres :: forall b -> b ~ O_dau => Builder -> Builder Source #

optEncode :: forall s r. (Typeable r, Eq r, Show r) => O_dau -> SPut s r Source #

optDecode :: forall b -> b ~ O_dau => OptionExtensionVal b -> Int -> SGet EdnsOption Source #

KnownEdnsOption O_dhu Source # 
Instance details

Defined in Net.DNSBase.EDNS.Option.Secalgs

Associated Types

type OptionExtensionVal O_dhu 
Instance details

Defined in Net.DNSBase.EDNS.Option.Secalgs

Methods

optionExtensionVal :: forall b -> b ~ O_dhu => OptionExtensionVal O_dhu Source #

optNum :: forall b -> b ~ O_dhu => OptNum Source #

optPres :: forall b -> b ~ O_dhu => Builder -> Builder Source #

optEncode :: forall s r. (Typeable r, Eq r, Show r) => O_dhu -> SPut s r Source #

optDecode :: forall b -> b ~ O_dhu => OptionExtensionVal b -> Int -> SGet EdnsOption Source #

KnownEdnsOption O_n3u Source # 
Instance details

Defined in Net.DNSBase.EDNS.Option.Secalgs

Associated Types

type OptionExtensionVal O_n3u 
Instance details

Defined in Net.DNSBase.EDNS.Option.Secalgs

Methods

optionExtensionVal :: forall b -> b ~ O_n3u => OptionExtensionVal O_n3u Source #

optNum :: forall b -> b ~ O_n3u => OptNum Source #

optPres :: forall b -> b ~ O_n3u => Builder -> Builder Source #

optEncode :: forall s r. (Typeable r, Eq r, Show r) => O_n3u -> SPut s r Source #

optDecode :: forall b -> b ~ O_n3u => OptionExtensionVal b -> Int -> SGet EdnsOption Source #

Nat16 n => KnownEdnsOption (OpaqueOption n) Source # 
Instance details

Defined in Net.DNSBase.EDNS.Internal.Option.Opaque

Associated Types

type OptionExtensionVal (OpaqueOption n) 
Instance details

Defined in Net.DNSBase.EDNS.Internal.Option.Opaque

Methods

optionExtensionVal :: forall b -> b ~ OpaqueOption n => OptionExtensionVal (OpaqueOption n) Source #

optNum :: forall b -> b ~ OpaqueOption n => OptNum Source #

optPres :: forall b -> b ~ OpaqueOption n => Builder -> Builder Source #

optEncode :: forall s r. (Typeable r, Eq r, Show r) => OpaqueOption n -> SPut s r Source #

optDecode :: forall b -> b ~ OpaqueOption n => OptionExtensionVal b -> Int -> SGet EdnsOption Source #

registerEdnsOption :: forall a -> KnownEdnsOption a => ResolverConf -> ResolverConf Source #

Register an EDNS option decoder. If the EDNS option's data type is itself extensible, you can use extendEdnsOptionWithType or extendEdnsOptionWithValue to apply additional extensions on top.

The registration takes precedence over the library's built-in decoder at the same option code (if any) after the merge step in makeResolvSeed.

extendEdnsOptionWithType :: forall t -> (KnownEdnsOption t, TypeExtensible t (OptionExtensionVal t)) => forall b -> TypeExtensionArg t b => ResolverConf -> ResolverConf Source #

Extend the registered decoder for a type-extensible EDNS option type t with an additional typed extension b. If t is not yet present in the resolver configuration, it is first registered, in either case extendByType is then applied fold in b.

This is the EDNS-option-side parallel to extendRRwithType.

extendEdnsOptionWithValue :: forall t -> (KnownEdnsOption t, ValueExtensible t (OptionExtensionVal t)) => forall b. ValueExtensionArg t b => b -> ResolverConf -> ResolverConf Source #

Extend the registered codec for EDNS option type t with a caller-supplied value v, whose type satisfies t's ValueExtensionArg constraint. The EDNS-option-side parallel to extendRRwithValue. This is the canonical way to add an EDE info-code → friendly-name mapping:

conf
    & extendEdnsOptionWithValue O_ede (33, "Frobnicated")
    & extendEdnsOptionWithValue O_ede (34, "Bogosity")

class (Typeable a, Eq a, Ord a, Show a, Presentable a) => KnownSVCParamValue a Source #

The class of types representing the value side of a service parameter inside an SVCB or HTTPS record. Each instance corresponds to a specific SVCParamKey; the encodeSPV and decodeSPV methods handle only the value bytes. The surrounding (key, length) frame is owned by the SVCB-record encoder: encodeSPV writes just the payload, and the framework wraps the result in the 2-byte length prefix. For value-less parameters this means encodeSPV is just pure ().

The Presentable instance builds the RFC 9460 zone-file presentation form: the key name followed (where the value is non-empty) by = and the value. The Show instance is typically derived and aims to produce syntactically valid Haskell.

Minimal complete definition

spvKey, encodeSPV, decodeSPV

Instances

Instances details
KnownSVCParamValue SPV_alpn Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Methods

spvKey :: forall b -> b ~ SPV_alpn => SVCParamKey Source #

spvKeyPres :: forall b -> b ~ SPV_alpn => Builder -> Builder Source #

encodeSPV :: ErrorContext r => SPV_alpn -> SPut s r Source #

decodeSPV :: forall b -> b ~ SPV_alpn => Int -> SGet SVCParamValue Source #

KnownSVCParamValue SPV_docpath Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Methods

spvKey :: forall b -> b ~ SPV_docpath => SVCParamKey Source #

spvKeyPres :: forall b -> b ~ SPV_docpath => Builder -> Builder Source #

encodeSPV :: ErrorContext r => SPV_docpath -> SPut s r Source #

decodeSPV :: forall b -> b ~ SPV_docpath => Int -> SGet SVCParamValue Source #

KnownSVCParamValue SPV_dohpath Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Methods

spvKey :: forall b -> b ~ SPV_dohpath => SVCParamKey Source #

spvKeyPres :: forall b -> b ~ SPV_dohpath => Builder -> Builder Source #

encodeSPV :: ErrorContext r => SPV_dohpath -> SPut s r Source #

decodeSPV :: forall b -> b ~ SPV_dohpath => Int -> SGet SVCParamValue Source #

KnownSVCParamValue SPV_ech Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Methods

spvKey :: forall b -> b ~ SPV_ech => SVCParamKey Source #

spvKeyPres :: forall b -> b ~ SPV_ech => Builder -> Builder Source #

encodeSPV :: ErrorContext r => SPV_ech -> SPut s r Source #

decodeSPV :: forall b -> b ~ SPV_ech => Int -> SGet SVCParamValue Source #

KnownSVCParamValue SPV_ipv4hint Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

KnownSVCParamValue SPV_ipv6hint Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

KnownSVCParamValue SPV_mandatory Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

KnownSVCParamValue SPV_ndalpn Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Methods

spvKey :: forall b -> b ~ SPV_ndalpn => SVCParamKey Source #

spvKeyPres :: forall b -> b ~ SPV_ndalpn => Builder -> Builder Source #

encodeSPV :: ErrorContext r => SPV_ndalpn -> SPut s r Source #

decodeSPV :: forall b -> b ~ SPV_ndalpn => Int -> SGet SVCParamValue Source #

KnownSVCParamValue SPV_port Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Methods

spvKey :: forall b -> b ~ SPV_port => SVCParamKey Source #

spvKeyPres :: forall b -> b ~ SPV_port => Builder -> Builder Source #

encodeSPV :: ErrorContext r => SPV_port -> SPut s r Source #

decodeSPV :: forall b -> b ~ SPV_port => Int -> SGet SVCParamValue Source #

KnownSVCParamValue SPV_pvd Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Methods

spvKey :: forall b -> b ~ SPV_pvd => SVCParamKey Source #

spvKeyPres :: forall b -> b ~ SPV_pvd => Builder -> Builder Source #

encodeSPV :: ErrorContext r => SPV_pvd -> SPut s r Source #

decodeSPV :: forall b -> b ~ SPV_pvd => Int -> SGet SVCParamValue Source #

KnownSVCParamValue SPV_tlsgroups Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Nat16 n => KnownSVCParamValue (OpaqueSPV n) Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamValue

Methods

spvKey :: forall b -> b ~ OpaqueSPV n => SVCParamKey Source #

spvKeyPres :: forall b -> b ~ OpaqueSPV n => Builder -> Builder Source #

encodeSPV :: ErrorContext r => OpaqueSPV n -> SPut s r Source #

decodeSPV :: forall b -> b ~ OpaqueSPV n => Int -> SGet SVCParamValue Source #

class TypeExtensible a v where Source #

RR-data or EDNS-option types whose codec admits a type-driven extension. See Adding a custom RR type for an example of this mechanism in use, and Writing a type-driven extensible codec for the steps to implement a type-driven extensible codec of your own.

Associated Types

type TypeExtensionArg a b Source #

Constraint a caller's extension type b must satisfy.

Methods

extendByType :: forall t b -> (t ~ a, TypeExtensionArg t b) => v -> v Source #

Fold a caller's extension type b into the existing codec context value of type v.

class ValueExtensible a v where Source #

RR-data or EDNS-option types whose codec admits a value-driven extension. See Adding a valud-driven extension for an example of this mechanism in use, and Writing a value-driven extensible codec for the steps to implement a value-driven extensible codec of your own.

Associated Types

type ValueExtensionArg a b Source #

Constraint a caller's extension value type b must satisfy.

Methods

extendByValue :: forall t -> t ~ a => forall b. ValueExtensionArg t b => b -> v -> v Source #

Fold a caller-supplied value of type b into the existing codec context value of type v.

Instances

Instances details
ValueExtensible O_ede (IntMap ShortByteString) Source # 
Instance details

Defined in Net.DNSBase.EDNS.Option.EDE

Associated Types

type ValueExtensionArg O_ede b 
Instance details

Defined in Net.DNSBase.EDNS.Option.EDE

Methods

extendByValue :: forall t -> t ~ O_ede => forall b. ValueExtensionArg t b => b -> IntMap ShortByteString -> IntMap ShortByteString Source #

Chained-composition opt-in

type DNSIO = ExceptT DNSError IO Source #

An opt-in monad for chaining multiple DNS operations with short-circuit error handling. The primary public API uses plain IO (Either DNSError a); DNSIO is a thin wrapper around ExceptT DNSError IO for users who prefer transformer-style composition. Convert between the two forms with runDNSIO and liftDNS.

runDNSIO :: DNSIO a -> IO (Either DNSError a) Source #

Run a DNSIO computation and return its Either DNSError a result in plain IO.

liftDNS :: IO (Either DNSError a) -> DNSIO a Source #

Lift a plain IO (Either DNSError a) action into DNSIO, for combining with other DNSIO steps.

Reference: all re-exported modules