MaxMind DB Reader Ruby API
Description
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).
Installation
gem install maxmind-db
Or from source:
gem build maxmind-db.spec
gem install ./maxmind-db-xxx.gem
Usage
require 'maxmind/db'
reader = MaxMind::DB.new('GeoIP2-City.mmdb', mode: MaxMind::DB::MODE_MEMORY)
record = reader.get('1.1.1.1')
if record.nil?
puts '1.1.1.1 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.
Requirements
This code requires Ruby version 2.3 or higher. Older versions may work, but are not supported.
Contributing
Patches and pull requests are encouraged. Please include unit tests whenever possible.
Support
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.
Versioning
This library uses Semantic Versioning.
Copyright and License
This software is Copyright (c) 2018 - 2019 by MaxMind, Inc.
This is free software, licensed under the Apache License, Version 2.0 or the MIT License, at your option.
Commit History @456a38ce-983e-4a01-95e7-0077833a7846/main
- Update watch file format version to 4. Kali Janitor 3 years ago
- Update standards version to 4.5.0, no changes needed. Kali Janitor 3 years ago
- Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, Repository-Browse. Kali Janitor 3 years ago
- Update URL in GitLab's CI configuration file Raphaël Hertzog 4 years ago
- Configure git-buildpackage for Kali Raphaël Hertzog 4 years ago
- Add GitLab's CI configuration file Raphaël Hertzog 4 years ago
- Update Vcs-* fields for the move to gitlab.com Raphaël Hertzog 5 years ago
- Initial release Sophie Brun 5 years ago
- New upstream version 1.0.0 Sophie Brun 5 years ago