Question

I'm experimenting with the MaxMind GeoIP (lite) DB.

Part of this is trying to see if I can make solid unittests.

For unittests I'd need to have some IP addresses I can rely on sending the same information always.

Most IP addresses will move around, and I'm assuming they're even more fluid in a GeoIP database, but are there some IP addresses I can reasonably rely on (for whatever reason)?

Was it helpful?

Solution 2

Martijn,

You can use the Pingdom probe servers IP address as reference. It is physical server running 24x7 and it is rarely reallocated to other locations unless required by data center.

https://www.pingdom.com/rss/probe_servers.xml

OTHER TIPS

You could also use a test database from the API unit tests. These are small enough to just include in your repo.

Approach 1: If the point is to test how your code behaves when Maxmind reports that an IP address is in a particular country or whatever, stub the Maxmind library method to return the answer you need for each test. I have used Maxmind and this approach was all I ever needed.

Approach 2: Pick a hostname which you expect to be in the country you need (say whitehouse.gov), look up its IP address each time you run the test, and use that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top