It's a tiny selfhosted service that determines the client's IP address or accepts an IP address through a query parameter, then returns geolocation and ASN information using the MaxMind GeoLite2 databases.

I often used services like ipinfo.io for checking my IP, location etc. e.g. to make sure a VPN was working properly. These are also handy for figuring out which timezone to use etc. I wanted to selfhost it, but couldn't find one that satisfied my needs. So I decided to write one.

Check out the README for details.

1 comment

sorted by: hot top controversial new old
[–] 1 point 1 hour ago

Nice zero-dep self-hosted API. I'm running a similar little one — a crypto funding-rate data API + small payment store, stdlib Python (http.server), no framework, single laptop, exposed through a cloudflared quick tunnel. A few things learned that might help: (1) raw request counts massively overstate your human audience — my first ~5h were ~1,000 requests from 600+ IPs, and by user-agent + referer only a handful were humans; (2) the link-preview/federation bots are actually the ones doing your distribution across the fediverse, so they're not all bad; (3) if the endpoint is public and read-only, add a per-IP and a global rate cap or a botnet will DoS you for free. Happy to compare notes.

  • source