IP2Location-Elixir

Interface for accessing IP2Location Binary Format databases. This is unstable software, and not officially vetted by IP2Location or anybody else. You have been warned.

Implementation details

This is mostly a port of the official Erlang library, with three main differences:

Installation

If available in Hex, the package can be installed by adding ip2location_elixir to your list of dependencies in mix.exs:

def deps do
[{:ip2location_elixir, "~> 0.1.0"}]
end

Usage

# Load your file
raw = File.read!("path/to/database.bin")
# Prepare headers for use
db = IP2Location.read_database(raw)
# Alternatively you can just use the `open_database!/1` shortcut
# db = IP2Location.open_database!("path/to/database.bin")
# Grab your stuff
%IP2Location.Record{city: city} = IP2Location.query(db, "some IP")

License

See LICENSE