porech / caddy-maxmind-geolocation

Caddy v2 module to filter requests based on source IP geolocation
102 stars 15 forks source link

[Feature Request] Support IPinfo MMDB databases #24

Open abdullahdevrel opened 4 months ago

abdullahdevrel commented 4 months ago

Hi,

We would like to bring IPinfo MMDB datasets to Caddy and hoping that the geolocation module can support that request.

We have the free IP to Country ASN dataset and the IP to geolocation dataset that we hope would be supported via this module. Even though we offer an MMDB database like MaxMind does there is a difference in schema between us. Our IP datasets are tabular or unnested, while their’s are nested.

Database schema for the IP to Country ASN dataset: https://ipinfo.io/developers/ip-to-country-asn-database

Field Name Example Data Type Description
start_ip 1.0.16.0 TEXT Starting IP address of an IP address range
end_ip 1.0.31.255 TEXT Ending IP address of an IP address range
country JP TEXT ISO 3166 country code of the location
country_name Japan TEXT Name of the country
continent AS TEXT Continent code of the country
continent_name Asia TEXT Name of the continent
asn AS2519 TEXT Autonomous System Number
as_name ARTERIA Networks Corporation TEXT Name of the AS (Autonomous System) organization
as_domain arteria-net.com TEXT Official domain or website of the AS organization

All our IP datasets come in MMDB format, however, to limit the scope of the request if you can support the IPinfo IP to Country ASN dataset in the module that will be incredible. The dataset providers full accuracy, daily updates, provides IPv4+IPv6 and has many more features.

ZeroAnarchy commented 2 months ago

For @abdullahdevrel and others who need this functionality: a good implementation of Caddy geo-module based on free IPInfo databases has recently appeared:

https://github.com/oltdaniel/caddy-ipinfo-free

abdullahdevrel commented 2 months ago

@ZeroAnarchy Thank you very much! I did not even know about the project.

This is a fantastic project as it natively supports database refresh with built-in cronjobs, which is a major feature as the free IP database is updated daily. It also supports the country ASN database, as I have consistently found ASN/ISP to be an equally important IP metadata factor in securing web servers.

Thank you ZeroAnarchy for pointing out the project. A big shoutout goes to @oltdaniel for building the project from scratch!