ip2proxy 3.2.0 → 3.2.1
raw patch · 5 files changed
+30/−14 lines, 5 filesdep ~aesondep ~basedep ~bytestringPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, base, bytestring, http-client
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- IP2Proxy.hs +22/−10
- IP2ProxyWebService.hs +1/−1
- LICENSE +1/−1
- ip2proxy.cabal +2/−2
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for ip2proxy +## 3.2.1 -- 2024-12-04++* Fixed boundary cases. Fixed IPv6 address error when using IPv4 BIN.+ ## 3.2.0 -- 2021-10-07 * Added support for IP2Proxy Web Service.
IP2Proxy.hs view
@@ -1,7 +1,7 @@ {-| Module : IP2Proxy Description : IP2Proxy Haskell package -Copyright : (c) IP2Location, 2021 +Copyright : (c) IP2Location, 2018 - 2024 License : MIT Maintainer : sales@ip2location.com Stability : experimental @@ -117,7 +117,7 @@ The 'getModuleVersion' function returns a string containing the module version. -} getModuleVersion :: String -getModuleVersion = "3.2.0" +getModuleVersion = "3.2.1" {-| The 'getPackageVersion' function returns a string containing the package version. @@ -332,25 +332,33 @@ search4 :: BS.ByteString -> Integer -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> IP2ProxyRecord search4 contents ipnum dbtype low high baseaddr indexbaseaddr colsize mode = do + let ipnum2 = if (ipnum == 4294967295) + then ipnum - 1 + else ipnum + if indexbaseaddr > 0 then do - let indexpos = fromIntegral (((ipnum `rotateR` 16) `rotateL` 3) + (toInteger indexbaseaddr)) + let indexpos = fromIntegral (((ipnum2 `rotateR` 16) `rotateL` 3) + (toInteger indexbaseaddr)) let low2 = readuint32 contents indexpos let high2 = readuint32 contents (indexpos + 4) - searchtree contents ipnum dbtype low2 high2 baseaddr colsize 4 mode + searchtree contents ipnum2 dbtype low2 high2 baseaddr colsize 4 mode else - searchtree contents ipnum dbtype low high baseaddr colsize 4 mode + searchtree contents ipnum2 dbtype low high baseaddr colsize 4 mode search6 :: BS.ByteString -> Integer -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> IP2ProxyRecord search6 contents ipnum dbtype low high baseaddr indexbaseaddr colsize mode = do + let ipnum2 = if (ipnum == 340282366920938463463374607431768211455) + then ipnum - 1 + else ipnum + if indexbaseaddr > 0 then do - let indexpos = fromIntegral (((ipnum `rotateR` 112) `rotateL` 3) + (toInteger indexbaseaddr)) + let indexpos = fromIntegral (((ipnum2 `rotateR` 112) `rotateL` 3) + (toInteger indexbaseaddr)) let low2 = readuint32 contents indexpos let high2 = readuint32 contents (indexpos + 4) - searchtree contents ipnum dbtype low2 high2 baseaddr colsize 6 mode + searchtree contents ipnum2 dbtype low2 high2 baseaddr colsize 6 mode else - searchtree contents ipnum dbtype low high baseaddr colsize 6 mode + searchtree contents ipnum2 dbtype low high baseaddr colsize 6 mode tryfirst myIP = do result <- try (evaluate (ipStringToInteger myIP)) :: IO (Either SomeException Integer) @@ -523,5 +531,9 @@ else if ipnum >= fromV4Compatible && ipnum <= toV4Compatible then do return $ search4 contents ipnum (databasetype meta) 0 (ipv4databasecount meta) (ipv4databaseaddr meta) (ipv4indexbaseaddr meta) (ipv4columnsize meta) mode - else do - return $ search6 contents ipnum (databasetype meta) 0 (ipv6databasecount meta) (ipv6databaseaddr meta) (ipv6indexbaseaddr meta) (ipv6columnsize meta) mode + else if (ipv6databasecount meta) == 0 + then do + let x = "IPV6 ADDRESS MISSING IN IPV4 BIN" + return $ IP2ProxyRecord x x x x x x x x x x x x x (-1) + else do + return $ search6 contents ipnum (databasetype meta) 0 (ipv6databasecount meta) (ipv6databaseaddr meta) (ipv6indexbaseaddr meta) (ipv6columnsize meta) mode
IP2ProxyWebService.hs view
@@ -2,7 +2,7 @@ {-| Module : IP2ProxyWebService Description : IP2Proxy Haskell package -Copyright : (c) IP2Location, 2021 +Copyright : (c) IP2Location, 2018 - 2024 License : MIT Maintainer : sales@ip2location.com Stability : experimental
LICENSE view
@@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 IP2Location.com +Copyright (c) 2018 - 2024 IP2Location.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
ip2proxy.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 3.2.0 +version: 3.2.1 -- A short (one-line) description of the package. synopsis: IP2Proxy Haskell package for proxy detection. @@ -60,7 +60,7 @@ -- other-extensions: -- Other library packages from which modules are imported. - build-depends: base >=4.9 && <=4.15, bytestring >=0.10 && <0.12, binary >=0.8.4 && <0.9, iproute >=1.7 && <1.8, aeson >=1.5 && <1.6, http-types >=0.12 && <0.13, http-client >=0.6 && <0.7, http-client-tls >=0.3 && <0.4, uri-encode >=1.5 && <1.6 + build-depends: base >=4.9 && <=4.21, bytestring >=0.10 && <0.13, binary >=0.8.4 && <0.9, iproute >=1.7 && <1.8, aeson >=1.5 && <2.3, http-types >=0.12 && <0.13, http-client >=0.6 && <0.8, http-client-tls >=0.3 && <0.4, uri-encode >=1.5 && <1.6 -- Directories containing source files. -- hs-source-dirs: