ip2proxy 2.0.0 → 2.1.0
raw patch · 4 files changed
+48/−33 lines, 4 files
Files
- ChangeLog.md +4/−0
- IP2Proxy.hs +22/−11
- LICENSE +21/−21
- ip2proxy.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for ip2proxy +## 2.1.0 -- 2019-07-22++* Added support for 6to4 and Teredo.+ ## 2.0.0 -- 2019-05-27 * Added support for PX5 to PX8 packages.
IP2Proxy.hs view
@@ -99,7 +99,7 @@ The 'getModuleVersion' function returns a string containing the module version. -} getModuleVersion :: String -getModuleVersion = "2.0.0" +getModuleVersion = "2.1.0" {-| The 'getPackageVersion' function returns a string containing the package version. @@ -435,21 +435,32 @@ doQuery :: String -> Meta -> String -> Int -> IO IP2ProxyRecord doQuery myfile meta myip mode = do contents <- BS.readFile myfile - let from = 281470681743360 - let to = 281474976710655 - let fromA = 0 - let toA = 4294967295 + let fromV4Mapped = 281470681743360 + let toV4Mapped = 281474976710655 + let fromV4Compatible = 0 + let toV4Compatible = 4294967295 + let from6To4 = 42545680458834377588178886921629466624 + let to6To4 = 42550872755692912415807417417958686719 + let fromTeredo = 42540488161975842760550356425300246528 + let toTeredo = 42540488241204005274814694018844196863 + let last32Bits = 4294967295 ipnum <- tryfirst myip if ipnum == -1 then do let x = "INVALID IP ADDRESS" return $ IP2ProxyRecord x x x x x x x x x x x (-1) - else if ipnum >= from && ipnum <= to + else if ipnum >= fromV4Mapped && ipnum <= toV4Mapped then do - return $ search4 contents (ipnum - (toInteger from)) (databasetype meta) 0 (ipv4databasecount meta) (ipv4databaseaddr meta) (ipv4indexbaseaddr meta) (ipv4columnsize meta) mode - else if ipnum >= fromA && ipnum <= toA + return $ search4 contents (ipnum - (toInteger fromV4Mapped)) (databasetype meta) 0 (ipv4databasecount meta) (ipv4databaseaddr meta) (ipv4indexbaseaddr meta) (ipv4columnsize meta) mode + else if ipnum >= from6To4 && ipnum <= to6To4 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 + return $ search4 contents ((ipnum `rotateR` 80) .&. last32Bits) (databasetype meta) 0 (ipv4databasecount meta) (ipv4databaseaddr meta) (ipv4indexbaseaddr meta) (ipv4columnsize meta) mode + else if ipnum >= fromTeredo && ipnum <= toTeredo + then do + return $ search4 contents ((complement ipnum) .&. last32Bits) (databasetype meta) 0 (ipv4databasecount meta) (ipv4databaseaddr meta) (ipv4indexbaseaddr meta) (ipv4columnsize meta) mode + 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
LICENSE view
@@ -1,21 +1,21 @@-MIT License--Copyright (c) 2019 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-in the Software without restriction, including without limitation the rights-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell-copies of the Software, and to permit persons to whom the Software is-furnished to do so, subject to the following conditions:--The above copyright notice and this permission notice shall be included in all-copies or substantial portions of the Software.--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE-SOFTWARE.+MIT License + +Copyright (c) 2019 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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.
ip2proxy.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 2.0.0+version: 2.1.0 -- A short (one-line) description of the package. synopsis: IP2Proxy Haskell package for proxy detection.