, NmcRRService(..)
, NmcRRI2p(..)
, NmcRRTls(..)
+ , NmcRRDs(..)
, emptyNmcDom
, mergeNmcDom
) where
merge _ b = b
data NmcRRI2p = NmcRRI2p
- { i2pDestination :: String
- , i2pName :: String
- , i2pB32 :: String
+ { i2pDestination :: Maybe String
+ , i2pName :: Maybe String
+ , i2pB32 :: Maybe String
} deriving (Show, Eq)
instance FromJSON NmcRRI2p where
parseJSON (Object o) = NmcRRI2p
- <$> o .: "destination"
- <*> o .: "name"
- <*> o .: "b32"
+ <$> o .:? "destination"
+ <*> o .:? "name"
+ <*> o .:? "b32"
parseJSON _ = empty
instance Mergeable NmcRRI2p where
(Map String [NmcRRTls]))
, domDs :: Maybe [NmcRRDs]
, domMx :: Maybe [String] -- Synthetic
+ , domSrv :: Maybe [String] -- Synthetic
} deriving (Show, Eq)
instance FromJSON NmcDom where
<*> o .:? "tls"
<*> o .:? "ds"
<*> return Nothing -- domMx not parsed
+ <*> return Nothing -- domSrv not parsed
parseJSON _ = empty
instance Mergeable NmcDom where
, domTls = mergelm domTls
, domDs = mergelm domDs
, domMx = mergelm domMx
+ , domSrv = mergelm domSrv
}
where
mergelm x = merge (x sub) (x dom)
emptyNmcDom = NmcDom Nothing Nothing Nothing Nothing Nothing Nothing
Nothing Nothing Nothing Nothing Nothing Nothing
Nothing Nothing Nothing Nothing Nothing Nothing
- Nothing
+ Nothing Nothing