Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Synopsis
- data LabelMap a
- insert :: ByteString -> a -> LabelMap a -> LabelMap a
- delete :: ByteString -> LabelMap a -> LabelMap a
- lookup :: ByteString -> LabelMap a -> Maybe a
- labelAssigned :: ByteString -> LabelMap a -> Bool
- empty :: LabelMap a
Types
A data structure for storing a hierarchical set of domain labels from TLD down, supporting wildcards.
Data structure is mutually recursive with LabelEntry
, and each level
of the tree supports a static assignment for a hostname such as:
example.com
Or a wildcard assignment for a hostname such as:
*.example.com
Or a wildcard assignment with a set of teptions, for example:
*.example.com admin.example.com
And lastly, empty labels are supported so that, of course, an assignment for example.com does not necessarily have any subdomains available. As an example suppose we have the following assigned domains:
example.com foo.example.com *.bar.example.com *.qux.example.com baz.qux.example.com
This will resolve to the following value, with some loose pseudocode notation.
Static (map) 'com' -> Unassigned Static (map) 'example' -> Assigned a (map) 'foo' -> Assigned a EmptyLabelMap 'bar' -> Unassigned (Wildcard (Assigned a EmptyLabelMap) 'qux' -> Unassigned (WildcardExcept (Assigned a (map))) 'baz' -> Assigned a EmptyLabelMap
Note that the hostname "bar.example.com" is unassigned, only the wildcard was set.
Helper functions
labelAssigned :: ByteString -> LabelMap a -> Bool Source #