Skip to content

Commit

Permalink
Applies Elasticsearch GeopIp interface changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mashhurs committed Jun 11, 2024
1 parent c7d376e commit 632bdee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LOGSTASH_PATH=../../ls
ELASTICSEARCH_TREEISH=8.13
ELASTICSEARCH_TREEISH=8.14
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
import org.elasticsearch.ingest.geoip.shaded.com.maxmind.geoip2.model.AnonymousIpResponse;
import org.elasticsearch.ingest.geoip.shaded.com.maxmind.geoip2.model.AsnResponse;
import org.elasticsearch.ingest.geoip.shaded.com.maxmind.geoip2.model.CityResponse;
import org.elasticsearch.ingest.geoip.shaded.com.maxmind.geoip2.model.ConnectionTypeResponse;
import org.elasticsearch.ingest.geoip.shaded.com.maxmind.geoip2.model.CountryResponse;
import org.elasticsearch.ingest.geoip.shaded.com.maxmind.geoip2.model.DomainResponse;
import org.elasticsearch.ingest.geoip.shaded.com.maxmind.geoip2.model.EnterpriseResponse;
import org.elasticsearch.ingest.geoip.shaded.com.maxmind.geoip2.model.IspResponse;

import java.io.Closeable;
import java.io.File;
Expand Down Expand Up @@ -54,16 +57,31 @@ public AsnResponse getAsn(InetAddress inetAddress) {
return getResponse(inetAddress, this.databaseReader::tryAsn);
}

/* @Override // neither available nor reachable until Elasticsearch 8.14 */
@Override
public AnonymousIpResponse getAnonymousIp(InetAddress ipAddress) {
return getResponse(ipAddress, this.databaseReader::tryAnonymousIp);
}

/* @Override // neither available nor reachable until Elasticsearch 8.14 */
@Override
public EnterpriseResponse getEnterprise(InetAddress ipAddress) {
return getResponse(ipAddress, this.databaseReader::tryEnterprise);
}

/* @Override // neither available nor reachable until Elasticsearch 8.15 */
public ConnectionTypeResponse getConnectionType(InetAddress inetAddress) {
return getResponse(inetAddress, this.databaseReader::tryConnectionType);
}

/* @Override // neither available nor reachable until Elasticsearch 8.15 */
public DomainResponse getDomain(InetAddress ipAddress) {
return getResponse(ipAddress, this.databaseReader::tryDomain);
}

/* @Override // neither available nor reachable until Elasticsearch 8.15 */
public IspResponse getIsp(InetAddress ipAddress) {
return getResponse(ipAddress, this.databaseReader::tryIsp);
}

private <T extends AbstractResponse> T getResponse(final InetAddress inetAddress, MaxmindTryLookup<T> resolver) {
try {
return resolver.lookup(inetAddress).orElse(null);
Expand Down

0 comments on commit 632bdee

Please sign in to comment.