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 disabledFilterTest() {

        when(maxMindCityResolver.isEnabled()).thenReturn(false);
        when(maxMindAsnResolver.isEnabled()).thenReturn(false);

        final GeoIpResolverEngine resolver = new GeoIpResolverEngine(geoIpVendorResolverService, config.toBuilder().enabled(false).build(), s3GeoIpFileService, metricRegistry);

        final Map<String, Object> messageFields = Maps.newHashMap();
        messageFields.put("_id", (new UUID()).toString());
        messageFields.put("source", "192.168.0.1");
        messageFields.put("message", "Hello from 1.2.3.4");
        messageFields.put("extracted_ip", "1.2.3.4");
        messageFields.put("ipv6", "2001:4860:4860::8888");

        final Message message = messageFactory.createMessage(messageFields);
        final boolean filtered = resolver.filter(message);

        assertFalse("Message should not be filtered out", filtered);
        assertEquals("Filter should not add new message fields", messageFields.size(), message.getFields().size());
    }