-
Notifications
You must be signed in to change notification settings - Fork 206
Closed
Description
I’m actually testing your database 5.0.1, using test data from MaxMind-DB.
I ran the following code:
@Test
public void checkDb() throws URISyntaxException, IOException, InvalidNetworkException {
URL testData = getClass().getClassLoader().getResource("test-data");
Path dir = Paths.get(testData.toURI());
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
for (Path p : stream) {
try (Reader reader = new Reader(p.toFile())) {
Metadata md = reader.getMetadata();
Networks<Object> n = reader.networks(Object.class);
System.err.format("%s -> %s%n", p, md.databaseType());
int success = 0;
int failures = 0;
for (Networks<Object> it = n; it.hasNext(); ) {
DatabaseRecord<Object> dr = it.next();
InetAddress ipInfo = dr.network().ipAddress();
try {
switch (md.databaseType()) {
case "GeoIP2-City", "GeoLite2-City", "GeoIP2-City-Shield" -> {
CityResponse response = reader.getRecord(ipInfo, CityResponse.class).data();
}
case "GeoIP2-Country", "GeoLite2-Country", "GeoIP2-Country-Shield" -> {
CountryResponse response = reader.getRecord(ipInfo, CountryResponse.class).data();
}
case "GeoIP2-Precision-Enterprise", "GeoIP2-Enterprise", "GeoIP2-Enterprise-Shield",
"GeoIP2-Precision-Enterprise-Shield" -> {
EnterpriseResponse response = reader.getRecord(ipInfo, EnterpriseResponse.class).data();
}
case "GeoIP-Anonymous-Plus", "GeoIP2-Anonymous-IP" -> {
AnonymousPlusResponse response = reader.getRecord(ipInfo, AnonymousPlusResponse.class).data();
}
case "GeoIP2-ISP" -> {
IspResponse response = reader.getRecord(ipInfo, IspResponse.class).data();
}
case "GeoIP2-IP-Risk" -> {
IpRiskResponse response = reader.getRecord(ipInfo, IpRiskResponse.class).data();
}
case "GeoIP2-Domain" -> {
DomainResponse response = reader.getRecord(ipInfo, DomainResponse.class).data();
}
case "GeoLite2-ASN" -> {
AsnResponse response = reader.getRecord(ipInfo, AsnResponse.class).data();
}
case "GeoIP2-Connection-Type" -> {
ConnectionTypeResponse response = reader.getRecord(ipInfo, ConnectionTypeResponse.class).data();
}
case "GeoIP2-DensityIncome" -> {}
case "GeoIP2-User-Count" -> {}
case "GeoIP2-Static-IP-Score" -> {}
default -> System.err.println("Unknown database type: " + md.databaseType());
}
success++;
} catch (IOException | RuntimeException e) {
failures++;
System.err.format(" %s: %s%n", ipInfo.getHostAddress(), e.getMessage());
}
}
System.err.format(" s=%d f=%s%n", success, failures);
}
}
}
}
and got some failures or interrogation.
I wonder why GeoIP2-DensityIncome, GeoIP2-User-Count or GeoIP2-Static-IP-Score don’t have associated classes in com.maxmind.geoip2.model, at least according to the javadoc ? Is that on purpose ?
But worst, some database seems to be unusable, as show by the output run:
GeoIP2-Precision-Enterprise-Test.mmdb -> GeoIP2-Precision-Enterprise
2.20.32.110: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
65.116.3.80: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
66.92.181.240: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
74.209.16.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
75.209.24.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
89.160.20.112: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
143.217.214.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
169.135.50.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
208.110.217.113: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
214.78.0.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
214.248.0.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
216.160.83.56: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
2001:219:0:0:0:0:0:0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
2001:220:0:0:0:0:0:0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
s=40 f=14
GeoIP2-Enterprise-Test.mmdb -> GeoIP2-Enterprise
89.160.20.112: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
214.78.0.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
216.160.83.56: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
2001:480:10:0:0:0:0:0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
s=15 f=4
GeoIP2-Enterprise-Shield-Test.mmdb -> GeoIP2-Enterprise-Shield
89.160.20.112: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
214.78.0.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
216.160.83.56: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
2001:480:10:0:0:0:0:0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
s=15 f=4
GeoIP2-Precision-Enterprise-Shield-Test.mmdb -> GeoIP2-Precision-Enterprise-Shield
2.20.32.110: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
65.116.3.80: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
66.92.181.240: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
74.209.16.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
75.209.24.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
89.160.20.112: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
143.217.214.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
169.135.50.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
208.110.217.113: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
214.78.0.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
214.248.0.0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
216.160.83.56: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
2001:219:0:0:0:0:0:0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
2001:220:0:0:0:0:0:0: No usable constructor on class com.maxmind.geoip2.model.ConnectionTypeResponse$ConnectionType. Annotate a constructor with MaxMindDbConstructor, provide a record canonical constructor, or a single public constructor.
s=40 f=14
GeoIP2-IP-Risk-Test.mmdb -> GeoIP2-IP-Risk
11.1.2.3: Error getting record for IP /11.1.2.3 - Error creating object of type: IpRiskResponse - argument type mismatch in is_anonymous_vpn MMDB Type: java.lang.Boolean Java Type: boolean argument type mismatch in is_anonymous MMDB Type: java.lang.Boolean Java Type: boolean argument type mismatch in is_public_proxy MMDB Type: java.lang.Boolean Java Type: boolean argument type mismatch in is_residential_proxy MMDB Type: java.lang.Boolean Java Type: boolean argument type mismatch in is_hosting_provider MMDB Type: java.lang.Boolean Java Type: boolean argument type mismatch in is_tor_exit_node MMDB Type: java.lang.Boolean Java Type: boolean
s=8 f=1
Metadata
Metadata
Assignees
Labels
No labels