<commit_before>var dns       = require('dns'),
    net       = require('net'),
    utils     = require('./utils'),
    net_utils = require('./net_utils');

exports.register = function () {
    var plugin = this;
    plugin.load_fcrdns_ini();
};

exports.load_fcrdns_ini = function () {
    var plugin = this;
    plugin.cfg = plugin.config.get('connect.fcrdns.ini', {
        booleans: [
            '-reject.no_rdns',
            '-reject.no_fcrdns',
            '-reject.invalid_tld',
            '-reject.generic_rdns',
        ]
    }, function () {
        plugin.load_fcrdns_ini();
    });
};

exports.hook_lookup_rdns = function (next, connection) {
    var plugin = this;
    var rip = connection.remote_ip;
    if (net_utils.is_private_ip(rip)) {
        connection.results.add(plugin, {skip: "private_ip"});
        return next();
    }

    connection.results.add(plugin, {
        fcrdns: [],               // PTR host names that resolve to this IP
        invalid_tlds: [],         // rDNS names with invalid TLDs
        other_ips: [],            // IPs from names that didn't match
        ptr_names: [],            // Array of host names from PTR query
        ptr_multidomain: false,   // Multiple host names in different domains
        has_rdns: false,          // does IP have PTR records?
        ptr_name_has_ips: false,  // PTR host has IP address(es)
        ptr_name_to_ip: {},       // host names and their IP addresses
    });

    plugin.refresh_config(connection);

    var called_next = 0;
    var timer;
    var do_next = function (code, msg) {
        if (called_next) return;
        called_next++;
        clearTimeout(timer);<commit_msg>fcrdns: always init results<commit_after>var dns       = require('dns'),
    net       = require('net'),
    utils     = require('./utils'),
    net_utils = require('./net_utils');

exports.register = function () {
    var plugin = this;
    plugin.load_fcrdns_ini();
};

exports.load_fcrdns_ini = function () {
    var plugin = this;
    plugin.cfg = plugin.config.get('connect.fcrdns.ini', {
        booleans: [
            '-reject.no_rdns',
            '-reject.no_fcrdns',
            '-reject.invalid_tld',
            '-reject.generic_rdns',
        ]
    }, function () {
        plugin.load_fcrdns_ini();
    });
};

exports.hook_lookup_rdns = function (next, connection) {
    var plugin = this;

    // always init, so results.get is deterministic
    connection.results.add(plugin, {
        fcrdns: [],               // PTR host names that resolve to this IP
        invalid_tlds: [],         // rDNS names with invalid TLDs
        other_ips: [],            // IPs from names that didn't match
        ptr_names: [],            // Array of host names from PTR query
        ptr_multidomain: false,   // Multiple host names in different domains
        has_rdns: false,          // does IP have PTR records?
        ptr_name_has_ips: false,  // PTR host has IP address(es)
        ptr_name_to_ip: {},       // host names and their IP addresses
    });

    var rip = connection.remote_ip;
    if (net_utils.is_private_ip(rip)) {
        connection.results.add(plugin, {skip: "private_ip"});
        return next();
    }

    plugin.refresh_config(connection);

    var called_next = 0;
    var timer;
    var do_next = function (code, msg) {
        if (called_next) return;
        called_next++;
        clearTimeout(timer);
{'fraction_non_alphanumeric': 0.12225153913808268, 'fraction_numerical': 0.0005863383172090296, 'mean_word_length': 2.060089686098655, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5539989', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1018, 'n_words': 252}