How to use the haraka-net-utils.ipv6_bogus function in haraka-net-utils

To help you get started, we’ve selected a few haraka-net-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github haraka / Haraka / plugins / mail_from.is_resolvable.js View on Github external
'No MX for your FROM address');
        }

        connection.logdebug(plugin, domain + ': A/AAAA => ' + addresses);
        let records = {};
        for (let i=0; i < addresses.length; i++) {
            const addr = addresses[i];
            // Ignore anything obviously bogus
            if (net.isIPv4(addr)){
                if (plugin.re_bogus_ip.test(addr)) {
                    connection.logdebug(plugin, domain + ': discarding ' + addr);
                    continue;
                }
            }
            if (net.isIPv6(addr)){
                if (net_utils.ipv6_bogus(addr)) {
                    connection.logdebug(plugin, domain + ': discarding ' + addr);
                    continue;
                }
            }
            records[addr] = true;
        }

        records = Object.keys(records);
        if (records && records.length) {
            txn.results.add(plugin, {pass: 'implicit_mx'});
            return mxDone();
        }

        txn.results.add(plugin, {fail: 'implicit_mx('+domain+')'});
        return mxDone();
    });
github haraka / Haraka / plugins / mail_from.is_resolvable.js View on Github external
check_results();
                    return;
                }
                connection.logdebug(plugin, domain + ': MX ' + addr.priority +
                        ' ' + addr.exchange + ' => ' + addresses2);
                for (let i=0; i < addresses2.length; i++) {
                    // Ignore anything obviously bogus
                    if (net.isIPv4(addresses2[i])){
                        if (plugin.re_bogus_ip.test(addresses2[i])) {
                            connection.logdebug(plugin, addr.exchange +
                                    ': discarding ' + addresses2[i]);
                            continue;
                        }
                    }
                    if (net.isIPv6(addresses2[i])){
                        if (net_utils.ipv6_bogus(addresses2[i])) {
                            connection.logdebug(plugin, addr.exchange +
                                    ': discarding ' + addresses2[i]);
                            continue;
                        }
                    }
                    records[addresses2[i]] = 1;
                }
                check_results();
            });
        });