From: Eugene Crosser Date: Wed, 30 Apr 2014 16:09:31 +0000 (+0400) Subject: wip TLSA X-Git-Tag: 0.9.0.0~6 X-Git-Url: http://average.org/gitweb/?a=commitdiff_plain;h=518fb5e9066cb2f77cd3291289d85c00cbee0ffb;p=pdns-pipe-nmc.git wip TLSA --- diff --git a/NmcTransform.hs b/NmcTransform.hs index 3cd37df..cc89abe 100644 --- a/NmcTransform.hs +++ b/NmcTransform.hs @@ -102,6 +102,30 @@ expandSrv base = && srvPort sr == 25 then Just [(show (srvPrio sr)) ++ "\t" ++ (srvHost sr)] else Nothing +{- +-- | replace Tls with Tlsa down in the Map +-- This function is almost, but not quite, entirely unlike expandSrv. +expandTls :: NmcDom -> NmcDom +expandTls base = + let + base' = base { domTls = Nothing } + in + case domTls base of + Nothing -> base' + Just sl -> foldr addTlsa base' sl + where + addTlsa sr acc = sub1 `mergeNmcDom` acc + where + sub1 = def { domMap = Just (singleton proto sub2) } + sub2 = def { domMap = Just (singleton port sub3) } + sub3 = def { domTlsa = Just [tlsStr] } + proto = "_" ++ (tlsProto sr) + port = "_" ++ (tlsName sr) + tlsStr = (show (tlsPrio sr)) ++ "\t" + ++ (show (tlsWeight sr)) ++ " " + ++ (show (tlsPort sr)) ++ " " + ++ (tlsHost sr) +-} -- | Convert map elements of the form "subN...sub2.sub1.dom.bit" -- into nested map and merge it