Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access network field from GeoLite2-ASN.mmdb #81

Closed
darix opened this issue Jun 20, 2019 · 5 comments
Closed

access network field from GeoLite2-ASN.mmdb #81

darix opened this issue Jun 20, 2019 · 5 comments

Comments

@darix
Copy link

darix commented Jun 20, 2019

The following ruby script

require 'maxminddb'
db = MaxMindDB.new('GeoLite2-ASN.mmdb')
p db.lookup('1.1.1.1')

gives me this output (reformatted for readability):

#<MaxMindDB::Result:0x000055a27cd962b8
  @raw={
    "autonomous_system_number"=>13335,
    "autonomous_system_organization"=>"Cloudflare, Inc.",
    "network"=>"1.1.1.0/24"
  }>

How to access the "network" field from within mod_maxminddb?
Are the ruby bindings just exposing this by accident?
I just noticed the python bindings aren't exposing it.

It would be really helpful to replace mod_asn with mod_maxminddb.

@oschwald
Copy link
Member

This is not currently available in mod_maxminddb or the library it uses. It is feature specific to the third-party Ruby API you are using.

@darix
Copy link
Author

darix commented Jun 20, 2019

How much work would it be to fix that for the library? Should I open a bug there as well?

@darix
Copy link
Author

darix commented Jun 20, 2019

I guess one option would be to generate a custom ASN mmdb file based on the CSV and then expose the subnet in another field?

@oschwald
Copy link
Member

You could generate such an mmdb file. It would likely end up being fairly large as it wouldn't be able to deduplicate the records.

Adding support for retrieving the network is something we are considering for some of our APIs. You could open a bug against libmaxminddb as well, if there isn't one, as that would need to be updated first.

@oschwald
Copy link
Member

This was done in #82. We have not done a release with it yet though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants