GeoIP2-java
GeoIP2-java copied to clipboard
Fail-fast on IP addresses that will always return AddressNotFoundException
There are certain IP addresses that will always result in an AddressNotFoundException such as those in private address spaces (e.g. 10.0.0.0 – 10.255.255.255).
It would be nice if the client checked and returned an AddressNotFoundException (or perhaps a new child class such as PrivateAddressException) instead hitting the API, resulting in wasted time on wire and use of API credits.
I'm not sure what the full set of reserved/private and otherwise hardcoded "bad" ip ranges would be, but a good start would be to do a quick call such as ip.isAnyLocalAddress() before calling out to the MaxMind API.
That does sound like a useful enhancement. Perhaps isSiteLocalAddress could be used.
As an aside, MaxMind does not charge for failed requests.