Hi there!
Here is a ready-to-deploy IP geolocation server. It works for both IPv4 and IPv6. However, the underlying database isn't very large. It uses the OpenGeoFeed database, available here.
Here's a command to run it using Docker:
docker run -p 8080:8080 ghcr.io/realchandan/ip-geo-api
curl localhost:8080/getIpInfo?addr=140.82.114.3
{ "ok": true, "country": "US", "ip_addr": "140.82.114.3", "ip_v6": false }
You can set AUTO_UPDATE=true as an environment variable to make the program check for updates every time. Also, be sure to mount /app/data as a Docker volume so downloaded CSVs can be saved.
The database is licensed under CC0.
This means:
CC0 doesn't legally require users of the data to cite the source!
But feel free to attribute the IP database provider! ❤️
The code in this repository is licensed under the MIT License.