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

Net.DNSBase.RData.SVCB

Description

The Service Binding RR (T_svcb) and its HTTPS-specific variant (T_https), defined by RFC 9460. Both share a wire format with three fields — priority, target name, and a list of typed (key, value) service parameters — represented internally by the X_svcb data type, indexed by a type-level natural that determines the specific RR type.

The service-parameter machinery is split across submodules:

New service-parameter value types can be installed at runtime via extendRRwithType on the SVCB or HTTPS RR type — see Net.DNSBase.Extensible for a worked example. The mandatory key (codepoint 0) is reserved and cannot be replaced by user code.

Synopsis

SVCB and HTTPS

data X_svcb (n :: Nat) Source #

Shared wire-format representation for the SVCB service binding record (RFC 9460 section 2) and its HTTPS-specific variant (RFC 9460 section 9). The type parameter n (either N_svcb or N_https) determines the RR type. Each has its own type synonym (T_svcb, T_https) and matching record pattern synonym (T_SVCB, T_HTTPS) with the corresponding field-name prefix (svc, https). The wire format is shared, but the type role of n is nominal: a T_svcb value cannot be used where a T_https is expected. This is deliberate — the two RR types serve different transports, and future SvcParamKeys may apply to only one of them.

                                1  1  1  1  1  1
  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                  SvcPriority                  |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
/                  TargetName                   /
/                                               /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
/                   SvcParams                   /
/                                               /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

The target field is not subject to wire-form name compression (RFC 3597 section 4) and is not in the RFC 4034 section 6.2 list of types that lower-case their RDATA names — it is compared case-sensitively in canonical form. The Ord instance compares structurally on the parsed fields rather than on the wire form, so it is not canonical: callers that need RFC 4034 canonical ordering must serialise to wire form first.

The SvcParams field is a list of (key, length, value) triples — possibly empty — making up the rest of the RData:

                                1  1  1  1  1  1
  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                  SvcParamKey                  |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                  SvcParamLen                  |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
/                  SvcParamValue                /
/                                               /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

On the wire the list must be in strictly ascending key order; the presentation form may list keys in any order. Each value has the type associated with its key in the decoder state configured for the RR type — keys absent from the state decode as OpaqueSPV, preserving the raw bytes.

The record pattern synonyms T_SVCB and T_HTTPS build the corresponding T_svcb or T_https value directly, with their own field-name prefixes (svc and https):

let s = T_SVCB  { svcPriority      = 0
                , svcTarget        = RootDomain
                , svcParamValues   = [] }
    h = T_HTTPS { httpsPriority    = 0
                , httpsTarget      = RootDomain
                , httpsParamValues = [] }
 in RData s : RData h : []

Functions that work on either RR type can use the underscore-prefixed selectors on the shared X_svcb record:

aliasDomain :: forall n. X_svcb n -> Maybe Domain
aliasDomain r | _svcPriority r == 0 = Just $ _svcTarget r
              | otherwise           = Nothing

Constructors

X_SVCB 

Fields

Bundled Patterns

pattern T_SVCB

Record pattern synonym viewing the shared X_svcb record as a generic SVCB service-binding record (RFC 9460). Fields: svcPriority, svcTarget, svcParamValues. See X_svcb for why T_svcb and T_https are not coercible.

Fields

pattern T_HTTPS

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

Fields

Instances

Instances details
Presentable (X_svcb n) Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB

(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 #

KnownSymbol (XsvcbConName n) => Show (X_svcb n) Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB

Methods

showsPrec :: Int -> X_svcb n -> ShowS #

show :: X_svcb n -> String #

showList :: [X_svcb n] -> ShowS #

Eq (X_svcb n) Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB

Methods

(==) :: X_svcb n -> X_svcb n -> Bool #

(/=) :: X_svcb n -> X_svcb n -> Bool #

Ord (X_svcb n) Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB

Methods

compare :: X_svcb n -> X_svcb n -> Ordering #

(<) :: X_svcb n -> X_svcb n -> Bool #

(<=) :: X_svcb n -> X_svcb n -> Bool #

(>) :: X_svcb n -> X_svcb n -> Bool #

(>=) :: X_svcb n -> X_svcb n -> Bool #

max :: X_svcb n -> X_svcb n -> X_svcb n #

min :: X_svcb n -> X_svcb n -> X_svcb n #

type RDataExtensionVal (X_svcb n) Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB

type TypeExtensionArg (X_svcb n) b Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB

type family XsvcbConName (n :: Nat) :: Symbol where ... Source #

Equations

XsvcbConName N_svcb = "T_SVCB" 
XsvcbConName N_https = "T_HTTPS" 
XsvcbConName n = TypeError ('ShowType n ':<>: 'Text " is not a SVCB-based RRTYPE") :: Symbol 

type T_svcb = X_svcb N_svcb Source #

X_svcb specialised to SVCB records.

type T_https = X_svcb N_https Source #

X_svcb specialised to HTTPS records.

T_SVCB fields

T_HTTPS fields

Service parameter values

class (Typeable a, Eq a, Ord a, Show a, Presentable a) => KnownSVCParamValue a where 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

Methods

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

The associated key number

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

CPS presentation form builder for the key

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

Encode value to wire form

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

Decode value from wire form

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 #

data SPVSet where Source #

The set of service parameters in an SVCB or HTTPS record, with at most one value per SVCParamKey. The Monoid instance provides the empty set; the Semigroup instance is left-biased on key collisions.

Bundled Patterns

pattern SPVMap

One-sided pattern that exposes the underlying IntMap for traversal or low-level inspection. The values are kept in the existential SVCParamValue wrapper, so any concrete parameter may be either typed (a KnownSVCParamValue instance) or OpaqueSPV. For typed lookups by parameter type use spvLookup instead.

Fields

Instances

Instances details
Presentable SPVSet Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPVSet

Monoid SPVSet Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPVSet

Semigroup SPVSet Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPVSet

IsList SPVSet Source #

Construction is via fromList, and enumeration is via toList.

Instance details

Defined in Net.DNSBase.RData.SVCB.SPVSet

Associated Types

type Item SPVSet 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPVSet

Show SPVSet Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPVSet

Eq SPVSet Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPVSet

Methods

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

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

type Item SPVSet Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPVSet

spvLookup :: KnownSVCParamValue a => SPVSet -> Maybe a Source #

Look up the parameter at the key associated with type a, returning a Just only when the stored value really is of type a. A value of the same key code but held as OpaqueSPV (because the typed instance was not registered when the record was decoded) does not match — opaque values must be retrieved through SPVMap.

newtype SPV_alpn Source #

The alpn service parameter (RFC 9460 section 7.1) — the set of Application-Layer Protocol Negotiation (RFC 7301) protocol identifiers this service endpoint supports. Together with SPV_ndalpn it defines the SVCB ALPN set: by default the scheme's protocol is implicitly included, and SPV_ndalpn suppresses that default.

newtype SPV_docpath Source #

The docpath service parameter (RFC 9953 section 8.2) — the absolute path to the DNS-over-CoAP (DoC) resource at this service endpoint, represented as a list of path segments. An empty list denotes the root path "/" (on the wire: a zero-length SvcParamValue).

Each segment is 1..255 octets per the RFC ABNF; the wire-form decoder rejects zero-length segments. Presentation form is a comma-separated list of segments using the standard RFC 9460 Appendix A.1 quoting and escaping rules, identical to those of SPV_alpn.

Instances

Instances details
Presentable SPV_docpath Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

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 #

Show SPV_docpath Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Eq SPV_docpath Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Ord SPV_docpath Source #

Wire-form canonical order: by total wire length first, then by the segment-list DnsText ordering.

Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

newtype SPV_dohpath Source #

The dohpath service parameter (RFC 9461) — a URI template (UTF-8) advertising the DNS-over-HTTPS endpoint at this service. Typically seen on resolver-discovery answers to queries for _dns.resolver.arpa or on explicit queries to a specific operator's resolver.

Constructors

SPV_DOHPATH Text 

newtype SPV_ech Source #

The ech service parameter (RFC9848, Section 3) — an Encrypted Client Hello (ECH) configuration list. Presented as a base64-encoded value.

Constructors

SPV_ECH ShortByteString 

Instances

Instances details
Presentable SPV_ech Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

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 #

Show SPV_ech Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Eq SPV_ech Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Methods

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

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

Ord SPV_ech Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

newtype SPV_ipv4hint Source #

The ipv4hint service parameter (RFC 9460 section 7.3) — a non-empty list of IPv4 addresses for this service endpoint that a client may use to start a connection in parallel with an authoritative A lookup. Hints are advisory; clients should still validate them against authoritative address records when they arrive.

Constructors

SPV_IPV4HINT (NonEmpty IPv4) 

newtype SPV_ipv6hint Source #

The ipv6hint service parameter (RFC 9460 section 7.3) — the IPv6 counterpart of SPV_ipv4hint: a non-empty list of IPv6 addresses to try in parallel with the authoritative AAAA lookup.

Constructors

SPV_IPV6HINT (NonEmpty IPv6) 

data SPV_mandatory where Source #

The mandatory service parameter (RFC 9460 section 8) — the set of additional SVCParamKey codes a client must recognise to make sense of this RR, on top of any keys that are automatically mandatory for the application protocol. A client that does not understand all the listed keys must ignore the RR.

The set may not be empty on the wire (an empty list is encoded as the parameter being absent) and may hold at most 32767 keys. The constructor is not exported; build instances via fromNonEmptyList or by combining values with their Semigroup instance.

Bundled Patterns

pattern SPV_MANDATORY

One-way pattern exposing the underlying key set for lookups. Construction is available only via fromNonEmptyList or via the Semigroup instance.

Fields

Instances

Instances details
Presentable SPV_mandatory Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

IsNonEmptyList SPV_mandatory Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Associated Types

type Item1 SPV_mandatory 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

KnownSVCParamValue SPV_mandatory Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Semigroup SPV_mandatory Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Show SPV_mandatory Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Eq SPV_mandatory Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Ord SPV_mandatory Source #

Wire-form order

Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

type Item1 SPV_mandatory Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

data SPV_ndalpn Source #

The no-default-alpn service parameter (RFC 9460 section 7.1) — a value-less flag that suppresses the scheme's default ALPN from the SVCB ALPN set. Meaningful only alongside an explicit SPV_alpn that supplies a replacement protocol list.

Constructors

SPV_NDALPN 

newtype SPV_port Source #

The port service parameter (RFC 9460 section 7.2) — overrides the scheme's default TCP or UDP port for reaching this service endpoint.

Constructors

SPV_PORT Word16 

Instances

Instances details
Presentable SPV_port Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

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 #

Bounded SPV_port Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Enum SPV_port Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Num SPV_port Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Read SPV_port Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Integral SPV_port Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Real SPV_port Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Show SPV_port Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Eq SPV_port Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Ord SPV_port Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

data SPV_pvd Source #

The pvd service parameter (draft-ietf-intarea-proxy-config-14 section 7.5) — a value-less flag that announces the host supports Provisioning Domain discovery via the well-known PvD URI. Its presence in an SVCB or HTTPS RR signals that a client MAY fetch PvD Additional Information from https://host/.well-known/pvd. Per the draft, the wire value MUST be empty; the presentation form is just the bare key name with no '='.

Constructors

SPV_PVD 

Instances

Instances details
Presentable SPV_pvd Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

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 #

Show SPV_pvd Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Eq SPV_pvd Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Methods

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

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

Ord SPV_pvd Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

newtype SPV_tlsgroups Source #

The tls-supported-groups service parameter (draft-ietf-tls-key-share-prediction-04 section 5) — a non-empty list of TLS Named Group codepoints (the IANA TLS Supported Groups registry) that the service supports. Clients can use this hint to predict an acceptable key share, reducing the chance of a HelloRetryRequest round-trip.

The wire form is a non-empty sequence of 16-bit codepoints in network byte order; the decoder rejects an empty value. The presentation form is a comma-separated list of decimal integers and forbids zone-file escape sequences (per the draft). Duplicates are flagged as a syntax error by the specification but are not currently rejected by either the encoder or the decoder — callers are expected to feed in a duplicate-free list, in their preferred order (the spec does not impose canonical ordering on the wire).

Constructors

SPV_TLSGROUPS (NonEmpty Word16) 

Instances

Instances details
Presentable SPV_tlsgroups Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

KnownSVCParamValue SPV_tlsgroups Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Show SPV_tlsgroups Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Eq SPV_tlsgroups Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

Ord SPV_tlsgroups Source #

Wire-form canonical order: by length first, then elementwise.

Instance details

Defined in Net.DNSBase.RData.SVCB.SPV

fromSPV :: KnownSVCParamValue a => SVCParamValue -> Maybe a Source #

Extract specific known SVCParamValue from existential wrapping

opaqueSPV :: Word16 -> ShortByteString -> SVCParamValue Source #

Build an SVCParamValue from a raw numeric key and a raw byte payload. Useful when a caller has a wire encoding for a key that has no registered KnownSVCParamValue instance, or when round-tripping bytes for keys that should remain uninterpreted.

serviceParamKey :: SVCParamValue -> SVCParamKey Source #

Key associated with a generic SvcParamValue

toOpaqueSPV :: SVCParamValue -> Either (EncodeErr (Maybe ())) SVCParamValue Source #

Encode an SVCParamValue to its OpaqueSPV equivalent under the same key code. Values that are already opaque are returned unchanged. For typed values this re-encodes the payload to wire form; encoding can fail (for example if the result would be too long to fit a 16-bit length field), in which case the EncodeErr is returned.

class (Typeable a, Eq a, Ord a, Show a, Presentable a) => KnownSVCParamValue a where 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

Methods

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

The associated key number

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

CPS presentation form builder for the key

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

Encode value to wire form

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

Decode value from wire form

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 #

data OpaqueSPV (n :: Nat) where Source #

Fallback carrier for service-parameter values whose key code has no KnownSVCParamValue instance registered. The key code is encoded as a type-level natural so OpaqueSPV values with different codes have distinct types. The wire payload is kept as raw bytes and round-trips losslessly; the presentation form is keyN=... with the value as a DnsText character-string.

Constructors

OpaqueSPV :: forall (n :: Nat). Nat16 n => ShortByteString -> OpaqueSPV n 

Instances

Instances details
Nat16 n => Presentable (OpaqueSPV n) Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamValue

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 #

Show (OpaqueSPV n) Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamValue

Eq (OpaqueSPV n) Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamValue

Methods

(==) :: OpaqueSPV n -> OpaqueSPV n -> Bool #

(/=) :: OpaqueSPV n -> OpaqueSPV n -> Bool #

Ord (OpaqueSPV n) Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamValue

data SVCParamValue Source #

Existential wrapper around any KnownSVCParamValue, so a single list can hold a mix of typed service parameters. The present method delegates to the underlying instance, which emits both the key name and the value.

Constructors

KnownSVCParamValue a => SVCParamValue a 

Instances

Instances details
Presentable SVCParamValue Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamValue

Show SVCParamValue Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamValue

Eq SVCParamValue Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamValue

Ord SVCParamValue Source #

Compare first by key number, then by content. When two key 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 key, 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.RData.SVCB.SVCParamValue

pattern ALPN :: SVCParamKey Source #

Application-Layer Protocol Negotiation identifiers RFC9460, Section 14.3.2

pattern DOCPATH :: SVCParamKey Source #

DNS over CoAP path RFC9953, Section 3

pattern DOHPATH :: SVCParamKey Source #

URI template for DNS-over-HTTPS resolver discovery RFC9461, Section 4

pattern ECH :: SVCParamKey Source #

Encrypted Client Hello configuration RFC9848, IANA Considerations

pattern IPV4HINT :: SVCParamKey Source #

Speculative IPv4 address hints RFC9460, Section 14.3.2

pattern IPV6HINT :: SVCParamKey Source #

Speculative IPv6 address hints RFC9460, Section 14.3.2

pattern MANDATORY :: SVCParamKey Source #

Keys the client must understand to use this RR RFC9460, Section 14.3.2

pattern NODEFAULTALPN :: SVCParamKey Source #

Suppress the default ALPN for this scheme RFC9460, Section 14.3.2

pattern OHTTP :: SVCParamKey Source #

Oblivious HTTP support indicator RFC9540, Section 4

pattern PORT :: SVCParamKey Source #

Alternative TCP/UDP port RFC9460, Section 14.3.2

newtype SVCParamKey Source #

A service-parameter key code (RFC 9460 section 2.1). The pattern synonyms below name the keys that have standardised value formats; an unrecognised code keeps its numeric form and presents as keyN.

Constructors

SVCParamKey Word16 

Instances

Instances details
Presentable SVCParamKey Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamKey

Bounded SVCParamKey Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamKey

Enum SVCParamKey Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamKey

Num SVCParamKey Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamKey

Read SVCParamKey Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamKey

Integral SVCParamKey Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamKey

Real SVCParamKey Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamKey

Show SVCParamKey Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamKey

Eq SVCParamKey Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamKey

Ord SVCParamKey Source # 
Instance details

Defined in Net.DNSBase.RData.SVCB.SVCParamKey