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

Net.DNSBase.Text

Description

Newtype wrappers that tag a byte string with a particular text-shaped presentation form: DnsText renders an opaque byte sequence as a DNS character-string with the standard \DDD escaping for non-printable bytes, and DnsUtf8Text renders a UTF-8 Text value with the same escape rules. The presentCharString, presentDomainLabel, and presentHostLabel helpers handle the per-context escape sets (character-strings, domain labels, and the stricter hostname form respectively). presentCSVList formats a comma-separated list value as used by multi-valued SVCB parameters.

Synopsis

Documentation

newtype DnsText Source #

Constructors

DnsText ShortByteString

Character string

Instances

Instances details
Presentable DnsText Source # 
Instance details

Defined in Net.DNSBase.Internal.Text

Show DnsText Source # 
Instance details

Defined in Net.DNSBase.Internal.Text

Eq DnsText Source # 
Instance details

Defined in Net.DNSBase.Internal.Text

Methods

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

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

Ord DnsText Source #

Canonical wire-form comparison of DNS character strings.

Instance details

Defined in Net.DNSBase.Internal.Text

newtype DnsUtf8Text Source #

Supports UTF8 character strings, which are presented like all other character strings, but must be valid UTF8 on the wire, and when unescaped from presentation form.

Constructors

DnsUtf8Text Text 

dnsTextCmp :: Coercible a ShortByteString => a -> a -> Ordering Source #

Compare wire-form character-strings, by length first.

presentCharString Source #

Arguments

:: ShortByteString

The bytes to encode.

-> Builder

Continuation

-> Builder 

Present a dns character-string with the given continuation. The result is enclosed in double-quotes.

presentDomainLabel Source #

Arguments

:: Word8

Label separator, typically 0x2e (.).

-> ByteString

The bytes to encode.

-> Builder

Continuation

-> Builder 

Present a Domain label with the given continuation.

presentHostLabel Source #

Arguments

:: Word8

Label separator, typically 0x2e (.).

-> ByteString

The bytes to encode.

-> Builder

Continuation

-> Builder 

Present a Host label folded to lower case, with the given continuation.

presentCSVList Source #

Arguments

:: [ShortByteString]

The elements to encode.

-> Builder

Continuation

-> Builder 

Present a Host label folded to lower case, with the given continuation.