-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | DNS name parsing and pattern matching utilities -- -- See the main module Network.DNS.Pattern for full documentation @package dns-patterns @version 0.1 -- | Provides utilities and parsers for a simple domain name pattern -- language. module Network.DNS.Pattern -- | 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 -- | 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 -- | 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 is terminated with a -- dot. absDomainRelaxP :: Parser Domain -- | A domain parsed into labels. Each label is a ByteString 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 [getDomain] :: Domain -> [DomainLabel] -- | Newtype warpper for ByteString that implements case-insensitive -- Eq and Ord as per RFC4343. newtype DomainLabel DomainLabel :: ByteString -> DomainLabel [getDomainLabel] :: DomainLabel -> ByteString -- | Print an arbitrary domain into a presentation format. -- -- This function nearly roundtrips with parseAbsDomain in the -- sense that octet escape sequences might change case or drop a leading -- zero. -- --
-- parseAbsDomain . pretty ~~~ id --pprDomain :: Domain -> Text -- | Print a singular domain label into a presentation format. pprDomainLabel :: DomainLabel -> Text -- | Parse a domain pattern. Convenience wrapper for 'patternP. parsePattern :: Text -> Either String DomainPattern -- | 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 given domain matches a DomainPattern matchesPattern :: Domain -> DomainPattern -> Bool -- | Parser for a singular domain label. See parseDomainLabel for a -- convenince wrapper. Also see absDomainP. domainLabelP :: Parser DomainLabel -- | Parser for domain patterns. See parsePattern for a convenince -- wrapper. patternP :: Parser DomainPattern -- | 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 :: ByteString -> 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 -- | Calculate the wire-encoded length of a domain name. encodedLength :: Domain -> Int -- | Print domain into presentation format. -- -- This function nearly roundtrips with parsePattern in the sense -- that octet escape sequences might change case or drop a leading zero. -- --
-- parsePattern . pprPattern ~~~ id --pprPattern :: DomainPattern -> Text instance GHC.Classes.Ord Network.DNS.Pattern.DomainPattern instance GHC.Classes.Eq Network.DNS.Pattern.DomainPattern instance GHC.Show.Show Network.DNS.Pattern.LabelPattern instance GHC.Classes.Ord Network.DNS.Pattern.LabelPattern instance GHC.Classes.Eq Network.DNS.Pattern.LabelPattern instance GHC.Classes.Ord Network.DNS.Pattern.Domain instance GHC.Classes.Eq Network.DNS.Pattern.Domain instance GHC.Classes.Ord Network.DNS.Pattern.DomainLabel instance GHC.Classes.Eq Network.DNS.Pattern.DomainLabel