-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | DNS name parsing and pattern matching utilities -- -- Domain name pattern matching, parsing and pretty printing utilities. -- See the modules Network.DNS.Pattern and Network.DNS for -- full documentation. @package dns-patterns @version 0.2.1 -- | This module is not part of public API and may change even between -- patch versions. module Network.DNS.Internal -- | Domain label with case-insensitive Eq and Ord as per -- RFC4343. data DomainLabel DomainLabel :: !ShortByteString -> !ShortByteString -> DomainLabel [getDomainLabel_] :: DomainLabel -> !ShortByteString [getDomainLabelCF_] :: DomainLabel -> !ShortByteString -- | A domain parsed into labels. Each label is a ShortByteString -- rather than Text or String because a label can contain -- arbitrary bytes. However, the Ord and Eq instances do -- limited case-folding according to RFC4343. newtype Domain Domain :: [DomainLabel] -> Domain -- | Difference list à la Huhges newtype DList a DList :: ([a] -> [a]) -> DList a -- | Turn a list into DList toDList :: [a] -> DList a -- | Turn DList back into a list. fromDList :: DList a -> [a] -- | Create a DList containing just the specified element singleton :: a -> DList a instance GHC.Classes.Ord Network.DNS.Internal.Domain instance GHC.Classes.Eq Network.DNS.Internal.Domain instance GHC.Base.Semigroup (Network.DNS.Internal.DList a) instance GHC.Base.Monoid (Network.DNS.Internal.DList a) instance GHC.Classes.Ord Network.DNS.Internal.DomainLabel instance GHC.Classes.Eq Network.DNS.Internal.DomainLabel -- | There is no standardized presentation and parsing format for domain -- names. In this library we assume a domain name and pattern to be -- specified as a text with an ASCII dot . acting as a separator -- and terminator. We do not admit arbitrary unicode codepoints, only the -- following subset of ASCII is acceptable per label: [a-z], [A-Z], -- [0-9], '_', -, * -- -- Punycoding, if desired, must be taken care of the user. -- -- In addition, we allow a backslash to be used as an escaping character -- for the following possible sequences: -- -- Escape sequences The domain name and pattern language here allows for -- the following escape sequences -- --
-- \. gives a dot inside a label, rather than a label separator -- \\ gives a backslash inside a label -- \012 gives an arbitrary octet inside a label as specified by the three octets ---- -- For example: foo\.bar.quux. is a domain name comprised of two -- labels foo.bar and quux module Network.DNS -- | A domain parsed into labels. Each label is a ShortByteString -- rather than Text or String because a label can contain -- arbitrary bytes. However, the Ord and Eq instances do -- limited case-folding according to RFC4343. data Domain -- | Turn a Domain into a list of its labels. -- --
-- getDomain . mkDomain ~~~ id ---- --
-- mkDomain . getDomain ~~~ id --getDomain :: Domain -> [DomainLabel] -- | Turn a list of labels into a Domain. -- --
-- getDomain . mkDomain ~~~ id ---- --
-- mkDomain . getDomain ~~~ id --mkDomain :: [DomainLabel] -> Domain -- | Domain label with case-insensitive Eq and Ord as per -- RFC4343. data DomainLabel -- | Get the wire-representation of a domain label. getDomainLabel :: DomainLabel -> ShortByteString -- | Get the RFC4343 case-folded wire-representation of a domain -- label. getDomainLabelCF :: DomainLabel -> ShortByteString -- | Smart constructor for DomainLabel mkDomainLabel :: ShortByteString -> DomainLabel -- | Unsafely construct a DomainLabel. The argument must already be -- case-folded according to RFC4343. unsafeMkDomainLabel :: ShortByteString -> DomainLabel -- | Unsafely construct a DomainLabel from a single Word8. The -- argument must already be case-folded according to RFC4343. unsafeSingletonDomainLabel :: Word8 -> DomainLabel -- | Case-folding of a domain according to RFC4343. Note -- Domain will memoize a case-folded variant for Eq, -- Ord and pretty printing already. This function is not useful to -- most. foldCase :: Domain -> Domain -- | Case-folding of a domain label according to RFC4343. Note -- DomainLabel will memoize a case-folded variant for Eq, -- Ord and pretty printing already. This function is not useful to -- most. foldCaseLabel :: DomainLabel -> DomainLabel -- | Parse an absolute domain. Convenience wrapper for absDomainP. parseAbsDomain :: Text -> Either String Domain -- | Version of parseAbsDomain that also considers a domain name without a -- trailing dot to be absolute. parseAbsDomainRelax :: Text -> Either String Domain -- | Parse a singular domain label. Convenience wrapper for -- domainLabelP. parseDomainLabel :: Text -> Either String DomainLabel -- | Attoparsec Parser for absolute domains. See -- parseAbsDomain for a convenience wrapper. For a parser that -- also admits domain forms without a leading dot, see -- absDomainRelaxP. absDomainP :: Parser Domain -- | Attoparsec Parser for absolute domains. See -- parseAbsDomainRelax for a convenience warpper. This variant -- differs from absDomainP in that it does not care whether the -- domain name ends in a dot. absDomainRelaxP :: Parser Domain -- | Attoparsec Parser for a singular domain label. See -- parseDomainLabel for a convenince wrapper. Also see -- absDomainP. domainLabelP :: Parser DomainLabel -- | Print an arbitrary domain into a presentation format. -- -- This function nearly roundtrips with parseAbsDomain up to -- escape sequence equivalence -- --
-- parseAbsDomain . pprDomain ~~~ id --pprDomain :: Domain -> Text -- | Print an arbitrary domain into a presentation format after -- case-folding according to RFC4343. -- -- This function nearly roundtrips with parseAbsDomain up to -- escape sequence equivalence and case folding. -- --
-- parseAbsDomain . pprDomainCF ~~~ id --pprDomainCF :: Domain -> Text -- | Print a singular domain label into a presentation format. pprDomainLabel :: DomainLabel -> Text -- | Print a singular domain label into a presentation format after -- case-folding according to RFC4343. pprDomainLabelCF :: DomainLabel -> Text -- | This module is not part of public API and may change even between -- patch versions. module Network.DNS.Pattern.Internal -- | Domain label with case-insensitive Eq and Ord as per -- RFC4343. data DomainLabel DomainLabel :: !ShortByteString -> !ShortByteString -> DomainLabel [getDomainLabel_] :: DomainLabel -> !ShortByteString [getDomainLabelCF_] :: DomainLabel -> !ShortByteString -- | A domain parsed into labels. Each label is a ShortByteString -- rather than Text or String because a label can contain -- arbitrary bytes. However, the Ord and Eq instances do -- limited case-folding according to RFC4343. newtype Domain Domain :: [DomainLabel] -> Domain -- | A pattern for a singular label. data LabelPattern -- | Represents an exact label that must be matched. DomLiteral :: DomainLabel -> LabelPattern -- | Represents a single asterisk glob matching any arbitrary domain at a -- given level. DomGlob :: LabelPattern -- | Represents a double asterisk matching any arbitrary subdomain at a -- given level. DomGlobStar :: LabelPattern -- | A domain pattern. newtype DomainPattern DomainPattern :: [LabelPattern] -> DomainPattern [getDomainPattern] :: DomainPattern -> [LabelPattern] instance GHC.Classes.Ord Network.DNS.Pattern.Internal.LabelPattern instance GHC.Classes.Eq Network.DNS.Pattern.Internal.LabelPattern instance GHC.Classes.Ord Network.DNS.Pattern.Internal.DomainPattern instance GHC.Classes.Eq Network.DNS.Pattern.Internal.DomainPattern -- | Patterns can be simple absolute domain names, where labels are -- replaceable with a single glob * or a globstar **. A -- single glob will match any label in its place, where globstar will -- greedily match as many labels as possible towards the left. -- -- Admits the escape sequences from domain names. See DNS. -- -- Note: Currently a globstar is only supported on the left-most label. -- -- Examples of valid patterns are: -- --
-- *.foo.bar. -- **.foo.bar. -- foo.*.bar. -- foo.bar.*. --module Network.DNS.Pattern -- | A domain pattern. newtype DomainPattern DomainPattern :: [LabelPattern] -> DomainPattern [getDomainPattern] :: DomainPattern -> [LabelPattern] -- | A pattern for a singular label. data LabelPattern -- | Represents an exact label that must be matched. DomLiteral :: DomainLabel -> LabelPattern -- | Represents a single asterisk glob matching any arbitrary domain at a -- given level. DomGlob :: LabelPattern -- | Represents a double asterisk matching any arbitrary subdomain at a -- given level. DomGlobStar :: LabelPattern -- | Test whether a given domain matches a DomainPattern matchesPattern :: Domain -> DomainPattern -> Bool -- | Given a pattern and a DNS zone specified by a domain name, test -- whether or not the pattern is applicable beneath that zone. -- --
-- foo.*.bar. applicable inside zone quux.bar. -- foo.bar. applicable inside zone bar. -- bar. applicable inside zone bar. -- foo.bar. not applicable inside zone quux. --patternWorksInside :: DomainPattern -> Domain -> Bool -- | Test whether a single label matches a label pattern labelMatchesPattern :: DomainLabel -> LabelPattern -> Bool -- | Parse a domain pattern. Convenience wrapper for 'patternP. parsePattern :: Text -> Either String DomainPattern -- | Attoparsec Parser for domain patterns. See parsePattern -- for a convenince wrapper. patternP :: Parser DomainPattern -- | Print domain pattern. -- -- This function nearly roundtrips with parsePattern up to escape -- sequence equivalence. -- --
-- parsePattern . pprPattern ~~~ id --pprPattern :: DomainPattern -> Text -- | Print domain pattern after into presentation format after case-folding -- according to RFC4343. -- -- This function nearly roundtrips with parsePattern up to escape -- sequence equivalence and case folding. -- --
-- parsePattern . pprPatternCF ~~~ id --pprPatternCF :: DomainPattern -> Text -- | Print a singular domain label pattern into a presentation format. pprLabelPattern :: LabelPattern -> Text -- | Print a singular domain label pattern into a presentation format after -- case-folding according to RFC4343. pprLabelPatternCF :: LabelPattern -> Text