geoip2 0.4.1.2 → 0.4.1.3
raw patch · 4 files changed
+14/−8 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.GeoIP2: _DataArray :: forall a_a7H7. Prism' (GeoFieldT a_a7H7) [GeoFieldT a_a7H7]
+ Data.GeoIP2: _DataArray :: forall a_a7rX. Prism' (GeoFieldT a_a7rX) [GeoFieldT a_a7rX]
- Data.GeoIP2: _DataBool :: forall a_a7H7. Prism' (GeoFieldT a_a7H7) Bool
+ Data.GeoIP2: _DataBool :: forall a_a7rX. Prism' (GeoFieldT a_a7rX) Bool
- Data.GeoIP2: _DataDouble :: forall a_a7H7. Prism' (GeoFieldT a_a7H7) Double
+ Data.GeoIP2: _DataDouble :: forall a_a7rX. Prism' (GeoFieldT a_a7rX) Double
- Data.GeoIP2: _DataInt :: forall a_a7H7. Prism' (GeoFieldT a_a7H7) Int64
+ Data.GeoIP2: _DataInt :: forall a_a7rX. Prism' (GeoFieldT a_a7rX) Int64
- Data.GeoIP2: _DataMap :: forall a_a7H7. Prism' (GeoFieldT a_a7H7) (Map (GeoFieldT a_a7H7) (GeoFieldT a_a7H7))
+ Data.GeoIP2: _DataMap :: forall a_a7rX. Prism' (GeoFieldT a_a7rX) (Map (GeoFieldT a_a7rX) (GeoFieldT a_a7rX))
- Data.GeoIP2: _DataString :: forall a_a7H7. Prism' (GeoFieldT a_a7H7) Text
+ Data.GeoIP2: _DataString :: forall a_a7rX. Prism' (GeoFieldT a_a7rX) Text
- Data.GeoIP2: _DataUnknown :: forall a_a7H7. Prism' (GeoFieldT a_a7H7) (Word8, Int64)
+ Data.GeoIP2: _DataUnknown :: forall a_a7rX. Prism' (GeoFieldT a_a7rX) (Word8, Int64)
- Data.GeoIP2: _DataWord :: forall a_a7H7. Prism' (GeoFieldT a_a7H7) Word64
+ Data.GeoIP2: _DataWord :: forall a_a7rX. Prism' (GeoFieldT a_a7rX) Word64
Files
- ChangeLog.md +4/−0
- Data/GeoIP2.hs +9/−1
- Data/GeoIP2/Fields.hs +0/−6
- geoip2.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+# 0.4.1.3++- Allow pointers in header data+ # 0.4.1.2 - Fix autonomous_system decoding
Data/GeoIP2.hs view
@@ -91,7 +91,8 @@ -- | Open database from a bytestring openGeoDBBS :: BS.ByteString -> Either String GeoDB openGeoDBBS bsmem = do- hdr <- decode (getHeaderBytes bsmem)+ hdr <- decode headerBytes >>= traversePtr strictHeaderAt+ when (hdr ^? key "binary_format_major_version" . geoNum /= (Just 2 :: Maybe Int)) $ Left "Unsupported database version, only v2 supported." unless (hdr ^? key "record_size" . geoNum `elem` (Just <$> [24, 28, 32 :: Int])) $@@ -105,6 +106,13 @@ <*> pure (hdr ^? key "description" . key "en" . _DataString) maybe (Left "Error decoding header") return res where+ headerBytes = getHeaderBytes bsmem++ strictHeaderAt :: Int64 -> Either String GeoField+ strictHeaderAt offset = do+ raw <- decode (BS.drop (fromIntegral offset) headerBytes)+ traversePtr (strictHeaderAt . fromIntegral) raw+ toVersion = geoNum . prism' pfrom pto where pfrom :: GeoIP -> Int
Data/GeoIP2/Fields.hs view
@@ -64,12 +64,6 @@ bytes <- getBytes (fromIntegral fsize) return $ BS.foldl' (\acc new -> fromIntegral new + 256 * acc) 0 bytes -instance Serialize GeoField where- put = error "Serialization not implemented"- get = do- field <- get- traversePtr (\_ -> fail "Pointer not accepted at this position") field- instance Serialize GeoFieldRaw where put = error "Serialization not implemented" get = do
geoip2.cabal view
@@ -1,5 +1,5 @@ name: geoip2-version: 0.4.1.2+version: 0.4.1.3 synopsis: Pure haskell interface to MaxMind GeoIP database description: GeoIP2 is a haskell binding to the MaxMind GeoIP2 database.