ip2location alternatives and similar packages
Based on the "Geolocation" category.
Alternatively, view ip2location alternatives based on common mentions on social networks and blogs.
-
topo
A Geometry library for Elixir that calculates spatial relationships between two geometries -
geoip
Elixir library to find geo location information given an IP address, hostname or Plug.Conn -
distance_api_matrix
Google Distance Matrix API Library for Elixir -
ipgeobase
Find Russian and Ukraine city by IP address and find country for other country Elixir -
srtm
Query locations for elevation data from the NASA Shuttle Radar Topography Mission -
segseg
Segment-segment intersection classifier and calculator for Elixir
Updating dependencies is time-consuming.
Do you think we are missing an alternative of ip2location or a related project?
README
IP2Location
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
- Download free IP2Location LITE databases at http://lite.ip2location.com
- Download IP2Location sample databases at http://www.ip2location.com/developers
License
*Note that all licence references and agreements mentioned in the ip2location README section above
are relevant to that project's source code only.