Popularity
2.9
Declining
Activity
0.0
Stable
19
3
1

Monthly Downloads: 2
Programming language: Elixir
License: GNU General Public License v3.0 only
Tags: Geolocation    
Latest version: v0.1.0

ip2location alternatives and similar packages

Based on the "Geolocation" category.
Alternatively, view ip2location alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of ip2location or a related project?

Add another 'Geolocation' Package

README

IP2Location

Build Status Hex pm

Elixir library for the IP2Location database. Supports IPv4 and IPv6.

Installation

Add IP2Location as a dependency to your project's mix.exs:

def application do
  [applications: [:ip2location]]
end

defp deps do
  [{:ip2location, github: "nazipov/ip2location-elixir"}]
end

and then run $ mix deps.get

Configuration

Add the path of the IP2Location database to your project's configuration:

use Mix.Config

database_file =
  [ __DIR__, "../data/sample-ipv6-db24.bin" ]
    |> Path.join()
    |> Path.expand()

config :ip2location,
  database: database_file,
  pool: [ size: 5, max_overflow: 10 ]

Usage

iex(1)> IP2Location.lookup("8.8.8.8")
%IP2Location.Result{ ... }
iex(1)> IP2Location.lookup("2001:4860:4860::8888")
%IP2Location.Result{ ... }

Benchmarking

iex(1)> :timer.tc(fn -> IP2Location.lookup("8.8.8.8") end )
{150, %IP2Location.Result{ ... }}
iex(2)> :timer.tc(fn -> IP2Location.lookup("2001:4860:4860::8888") end )
{152, %IP2Location.Result{ ... }}

Sample BIN Databases

License

GNU LGPLv3


*Note that all licence references and agreements mentioned in the ip2location README section above are relevant to that project's source code only.