com.github.tornaia.geoip.GeoIPProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-offline-geoip Show documentation
Show all versions of java-offline-geoip Show documentation
Java Offline GeoIP maps any IP address to its country code
package com.github.tornaia.geoip;
public final class GeoIPProvider {
public enum Type {
RESIDENT, RESIDENT_LAZY, NON_RESIDENT
}
private GeoIPProvider() {
}
public static GeoIP getGeoIP() {
return getGeoIP(Type.RESIDENT);
}
public static GeoIP getGeoIP(Type type) {
switch (type) {
case RESIDENT:
GeoIPResidentImpl residentGeoIP = new GeoIPResidentImpl();
residentGeoIP.getTwoLetterCountryCode("127.0.0.1");
return residentGeoIP;
case RESIDENT_LAZY:
return new GeoIPResidentImpl();
case NON_RESIDENT:
return new GeoIPNonResidentImpl();
default:
throw new IllegalStateException("Unexpected type: " + type);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy