Class MaxmindGeoIp

java.lang.Object
org.localify.common.geoip.MaxmindGeoIp
All Implemented Interfaces:
GeoIpService

public class MaxmindGeoIp extends Object implements GeoIpService
An implementation of GeoIpService that uses the MaxMind GeoIP2 database.
  • Constructor Details

    • MaxmindGeoIp

      public MaxmindGeoIp(com.maxmind.geoip2.DatabaseReader reader)
      Constructs a new MaxmindGeoIp.
      Parameters:
      reader - The MaxMind database reader.
  • Method Details

    • getDetails

      public GeoIpDetails getDetails(String ipAddress, boolean permitFallback)
      Description copied from interface: GeoIpService
      Gets the GeoIP details for a given IP address.
      Specified by:
      getDetails in interface GeoIpService
      Parameters:
      ipAddress - The IP address.
      permitFallback - Whether to permit fallback to a default location if the IP address is not found.
      Returns:
      The GeoIP details, or null if not found and fallback is not permitted.