GeoIP2-java icon indicating copy to clipboard operation
GeoIP2-java copied to clipboard

Fail-fast on IP addresses that will always return AddressNotFoundException

Open davidklebanoff opened this issue 7 years ago • 1 comments
trafficstars

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.

davidklebanoff avatar May 23 '18 23:05 davidklebanoff

That does sound like a useful enhancement. Perhaps isSiteLocalAddress could be used.

As an aside, MaxMind does not charge for failed requests.

oschwald avatar May 24 '18 14:05 oschwald