Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Data.Geolocation.GeoIP
- 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 #
combineOptions :: [GeoIPOption] -> GeoIPOption #
Collapse & combine multiple GeoIPOption
s into one
standard :: GeoIPOption #
Geolocation Result Type
data GeoIPRecord #
Return data for a geolocation lookup
Constructors
GeoIPRecord | |
Fields
|
Instances
Data Operations
openGeoDB :: GeoIPOption -> String -> IO GeoDB #
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) #
Geo-locate by given IP Adress
geoLocateByIPAddress db "123.123.123.123"
geoLocateByIPNum :: GeoDB -> Integer -> IO (Maybe GeoIPRecord) #
geoStringByIPAddress :: GeoDB -> ByteString -> IO (Maybe ByteString) #
geoStringByIPNum :: GeoDB -> Integer -> IO (Maybe ByteString) #
mkIpNum :: ByteString -> Maybe Integer #
Convert a string IP adress to IPNum