mmdb
gem provide to fast look up ip address from MaxMindDB(in GeoIP2 format) database.
mmdb
has been depended to libmaxminddb.
Please install libmaxminddb
with installation guide in README.md.
Then, add this line to your application's Gemfile:
gem 'mmdb'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mmdb
mmdb = MaxMindDB.new("path/to/GeoLite2-City.mmdb")
mmdb.lookup("118.240.137.106")
#=>
#{
# :city=>"Tokyo",
# :country=>"Japan",
# :country_code=>"JP",
# :continent=>"Asia",
# :latitude=>35.6502,
# :longitude=>139.6939,
# :postcode=>"153-0042"
#}
Bug reports and pull requests are welcome on GitHub at https://github.com/yoppi/mmdb.
The gem is available as open source under the terms of the MIT License.