Git Product home page Git Product logo

Comments (6)

abdullahdevrel avatar abdullahdevrel commented on June 11, 2024 1

@g-andrade My apologies. I should have been clearer. I wanted to mention that the structure is tabular. You know how in MaxMind, if you want to get the city name of an IP address, you have to go through city → en → iso_code. With us, it is just city.

Here is a GIF of using the MMDB database using the mmdbctl tool.

WindowsTerminal_LIlhqd7RG8

No rush. This is just a request. I really appreciate your taking a look. Thank you very much.

from locus.

g-andrade avatar g-andrade commented on June 11, 2024 1

No worries about the IPv4 issue, it was indeed a bug that had been present in locus since forever, only it didn't show up with other databases:
#44

It's fixed in the latest version, which I pushed today.

from locus.

g-andrade avatar g-andrade commented on June 11, 2024

Hi @abdullahdevrel, after a very quick look at your proposal, I think it’s important to clarify that MMDB as supported by locus refers to a particular binary format:
https://maxmind.github.io/MaxMind-DB/

These tabular files (from a first look, either JSON or CSV) are, effectively, in an entirely different format that locus doesn’t know about. Calling them MMDB would be akin to saying an SVG image is just like a PNG one, only in vector format!

Let me know if I got it wrong - as I wrote earlier, I took a very quick look and got alarmed at seeing what may not be MMDB at all. An entirely different format would raise very substantially the technical cost for any kind of support.

from locus.

g-andrade avatar g-andrade commented on June 11, 2024

My bad, I got the wrong thought when I read tabular. As long as it’s MMDB, there should be no issue. I’ll give it a try when I get a chance.

from locus.

g-andrade avatar g-andrade commented on June 11, 2024

Overall compatibility

The free IPinfo ASN, Country and Country+ASN databases load alright from the local filesystem:

Screenshot from 2024-05-04 17-17-45

Possible IPv4 bug

IPv4 lookups may not be working (tried 93.184.215.14, the address for example.com);
IPv6 lookups are (tried 2606:2800:21f:cb07:6820:80da:af6b:8b2c).

That reminded me of PR #39, closed a few months ago. Given what it appeared to suggest was in need of fixing:

% https://en.wikipedia.org/wiki/IPv6#IPv4-mapped_IPv6_addresses
-define(IPV4_IPV6_PREFIX, <<0:80, 16#FFFF:16>>).

..I tried switching the IPv4-in-IPv6 tree prefix from ::ffff:0:0/96 to ::/96, and it... worked? I can now get IPv4 entries from the IPinfo database.

There may be a 6+ years old bug in the code owing to my wrong interpretation of the spec, which I never encountered before out of chance.

Downloading (and updating) using HTTP

The databases can be loaded using HTTP (censor_query will censor the token in logged messages):
Screenshot from 2024-05-04 17-44-39

Although I very quickly hit the default limit of 10 daily downloads per database, which is not too bad since locus caches the database locally and subsequent requests are conditional (it sends if-modified-since to avoid unnecessary data transfer) but will log errors.

from locus.

abdullahdevrel avatar abdullahdevrel commented on June 11, 2024

@g-andrade Thank you very much for looking into the request. Really appreciate it!

Although I very quickly hit the default limit of 10 daily downloads per database

Can you please let me know the email account or the access token you used to sign up? You can email it to me if you'd like. My email is [email protected]. I will increase the rate limit.

I tried switching the IPv4-in-IPv6 tree prefix from ::ffff:0:0/96 to ::/96, and it... worked? I can now get IPv4 entries from the IPinfo database.

I will look into it. I have faced some similar errors when working with DuckDB's inet data type.

from locus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.