inspircd / inspircd-contrib

Third-party InspIRCd module repository.
https://www.inspircd.org
66 stars 72 forks source link

Supplement/Addition for geo_maxmind #271

Closed DiamantTh closed 12 months ago

DiamantTh commented 12 months ago

Hello,

I would be interested in an addition to the existing module geo_maxmind.

Instead of loading now the not readableGeoLite2-Country.mmdbone could supplement this by the readable GeoLite2-Country-Locations-(de,en).csv/GeoLite2-Country-Blocks-IPv4.csv

Greetings

SadieCat commented 12 months ago

Why? Those files contain the same data but the CSV data is in a less efficient format for the server to look data up in.

DiamantTh commented 12 months ago

Why? Those files contain the same data but the CSV data is in a less efficient format for the server to look data up in.

I think you should have as a user if already the choice what he prefers

SadieCat commented 12 months ago

Choice just for the sake of having choice isn't a good thing. Adding support for the CSV files would result in significantly slower lookup as they aren't optimised (the MMDB format is explicitly optimised for fast lookup), would increase the complexity of the module, and would increase the burden of maintenance whilst providing no actual benefit to the user over using the MMDB file.

Is there any actual reason to support them other than just to give users choice?

DiamantTh commented 12 months ago

Is it really so slow that an implementation is not worthwhile?

Another IRCd supports in addition exemplarily also still .dat files for the GEO-IP module beside the CSVs and the mmdb file...

SadieCat commented 12 months ago

Yes, it's extremely slow especially if you want IPv6 support where the search space is substantially bigger than for IPv4. CSV is not an optimised format for lookup and the CSV data is split across several files so in order to implement it efficiently we would probably need to implement a bunch of preprocessing so we could memory map it efficiently which would effectively be writing a ton of code (which needs to be maintained) that just reinvents the MMDB format.

It's just not worth it for something which, again, provides literally no benefit other than choice for the sake of choice.