stow fqdn sdom acc = insertWith mergeNmcDom fqdn' sdom' acc
where
(fqdn', sdom') =
- nest (map unpack (splitOn (pack ".") (pack fqdn)), sdom)
+ nest (filter (/= "") (splitOnDots fqdn), sdom)
+ splitOnDots s = map unpack (splitOn (pack ".") (pack s))
nest ([], v) = (fqdn, v) -- can split result be empty?
nest ([k], v) = (k, v)
nest (k:ks, v) =
#### map attribute
-FIXME - explain handling of the keys with dots.
-Also, add checks to the code to disallow empty elements.
-
JSON Map object containing subdomain names as its keys and domain
objects as values. Element of the map with empty key "" has special
meaning: the value of this map element is merged into the current
the current object.
```
-"map": { "www": { "alias" : "www.example.com." }
+"map": { "www": { "alias" : "www.example.com" }
, "www2": { "delegate": "d/example" }
}
```
+Note: When a key contains dots ".", it is converted to a nested
+map. If empty element appears as a result of split, such as when
+a dot is at the beginning or at the end of the key, or there are
+consequitive dots, such elemets are ignored. For example,
+
+```
+"map": { "www.uk": { "alias" : "www.example.co.uk" }
+ , "www..us": { "alias" : "www.example.com" }
+ , "smtp.us.": { "alias" : "smtp.example.com" }
+```
+
+is equivalent to
+
+```
+"map": { "uk": { "map": { "www": { "alias" : "www.example.co.uk" }}}
+ , "us": { "map": { "www": { "alias" : "www.example.com" }
+ , "smtp": { "alias" : "smtp.example.com" }}
+ }
+ }
+```
+
#### fingerprint attribute
Does not translate into any DNS RR. Contains a list of TLS
-{"service":[["smtp", "tcp", 0, 0, 25, "mail.host.com."]],"import":["d/extra2","d/extra3"],"ip":["1.2.3.4"],"alias":"extra1alias","map":{"mail":"1.1.1.1","www":"1.1.1.1","smtp.eu":{"ip6":"dead::0002"},"eu":{"map":{"smtp":{"ip6":["dead::0001"]}}}}}
+{"service":[["smtp", "tcp", 0, 0, 25, "mail.host.com."]],"import":["d/extra2","d/extra3"],"ip":["1.2.3.4"],"alias":"extra1alias","map":{"mail":"1.1.1.1","www":"1.1.1.1","smtp.eu":{"ip6":"dead::0002"},"smtp..eu.":{"ip6":"dead::0003"},"eu":{"map":{"smtp":{"ip6":["dead::0001"]}}}}}