Safe Haskell | None |
---|
- data GeoDB
- data GeoIPOption
- combineOptions :: [GeoIPOption] -> GeoIPOption
- standard :: GeoIPOption
- memory_cache :: GeoIPOption
- check_cache :: GeoIPOption
- index_cache :: GeoIPOption
- mmap_cache :: GeoIPOption
- data GeoIPRecord = GeoIPRecord {}
- openGeoDB :: GeoIPOption -> String -> IO GeoDB
- geoLocateByIPAddress :: GeoDB -> ByteString -> IO (Maybe GeoIPRecord)
- geoLocateByIPNum :: GeoDB -> Integer -> IO (Maybe GeoIPRecord)
- geoStringByIPAddress :: GeoDB -> ByteString -> IO (Maybe ByteString)
- geoStringByIPNum :: GeoDB -> Integer -> IO (Maybe ByteString)
- mkIpNum :: ByteString -> Maybe Integer
Types
data GeoIPOption Source
combineOptions :: [GeoIPOption] -> GeoIPOptionSource
Collapse & combine multiple GeoIPOption
s into one
Geolocation Result Type
data GeoIPRecord Source
Return data for a geolocation lookup
GeoIPRecord | |
|
Data Operations
openGeoDB :: GeoIPOption -> String -> IO GeoDBSource
Open the binary GeoIP data file with the given options.
This would open a file and cache in memory:
openGeoDB "GeoCity.dat" memory_cache
The memory on the C side is automatically freed by the Haskell GC when appropriate.
geoLocateByIPAddress :: GeoDB -> ByteString -> IO (Maybe GeoIPRecord)Source
Geo-locate by given IP Adress
geoLocateByIPAddress db "123.123.123.123"
geoLocateByIPNum :: GeoDB -> Integer -> IO (Maybe GeoIPRecord)Source
geoStringByIPAddress :: GeoDB -> ByteString -> IO (Maybe ByteString)Source
geoStringByIPNum :: GeoDB -> Integer -> IO (Maybe ByteString)Source
mkIpNum :: ByteString -> Maybe IntegerSource
Convert a string IP adress to IPNum