MaxMind DB Reader Ruby API
This is the Ruby API for reading MaxMind DB files. MaxMind DB is a binary file format that stores data indexed by IP address subnets (IPv4 or IPv6).
gem install maxmind-db
Or from source:
gem build maxmind-db.spec gem install ./maxmind-db-xxx.gem
require 'maxmind/db' reader = ::.('GeoIP2-City.mmdb', mode: ::::) record = reader.get('184.108.40.206') if record.nil? puts '220.127.116.11 was not found in the database' else puts record['country']['iso_code'] puts record['country']['names']['en'] end reader.close
For more information see the documentation.
This code requires Ruby version 2.3 or higher. Older versions may work, but are not supported.
Patches and pull requests are encouraged. Please include unit tests whenever possible.
Please report all issues with this code using the GitHub issue tracker.
If you are having an issue with a MaxMind service that is not specific to the client API, please see our support page.
This library uses Semantic Versioning.
Copyright and License
This software is Copyright (c) 2018 - 2019 by MaxMind, Inc.