public boolean filter(Message message) {
        if (!enabled) {
            return false;
        }

        List<String> ipFields = getIpAddressFields(message);

        for (String key : ipFields) {
            Object fieldValue = message.getField(key);
            final InetAddress address = getValidRoutableInetAddress(fieldValue);
            if (address == null) {
                continue;
            }

            // For reserved IPs just mark as reserved. Otherwise, enforce Graylog schema on only relevant IP fields
            // or add legacy fields on all IP fields in the message if enforcement is disabled.
            final String prefix = enforceGraylogSchema ? ipAddressFields.getOrDefault(key, key) : key;
            if (ReservedIpChecker.getInstance().isReservedIpAddress(address.getHostAddress())) {
                message.addField(prefix + "_reserved_ip", true);
            } else if (enforceGraylogSchema) {
                addGIMGeoIpDataIfPresent(message, address, prefix);
            } else {
                addLegacyGeoIpDataIfPresent(message, address, prefix);
            }
        }

        return true;
    }
@Test
    public void testFilterMaxMind() {

        final GeoIpResolverEngine engine = new GeoIpResolverEngine(geoIpVendorResolverService, config, s3GeoIpFileService, metricRegistry);

        Map<String, Object> fields = new HashMap<>();
        fields.put("_id", java.util.UUID.randomUUID().toString());
        fields.put("source_ip", publicIp.getHostAddress());

        Message message = messageFactory.createMessage(fields);
        engine.filter(message);

        String expectedGeoName = maxMindLocationInfo.cityName() + ", " + maxMindLocationInfo.countryIsoCode();
        Assertions.assertEquals(expectedGeoName, message.getField("source_geo_name"));
        Assertions.assertEquals(maxMindLocationInfo.region(), message.getField("source_geo_region"));
        Assertions.assertEquals(maxMindLocationInfo.cityName(), message.getField("source_geo_city"));
        Assertions.assertEquals(maxMindLocationInfo.timeZone(), message.getField("source_geo_timezone"));
        Assertions.assertEquals(maxMindLocationInfo.countryName(), message.getField("source_geo_country"));
        Assertions.assertEquals(maxMindAsnInfo.organization(), message.getField("source_as_organization"));
        Assertions.assertEquals(maxMindAsnInfo.asn(), message.getField("source_as_number"));

    }