Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

haraka-net-utils

Package Overview
Dependencies
Maintainers
4
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

haraka-net-utils - npm Package Compare versions

Comparing version 1.2.4 to 1.3.0

20

index.js

@@ -375,8 +375,20 @@ 'use strict';

if (!net.isIP(ip)) return (ip in list); // domain
const isHostname = !net.isIP(ip);
const isArray = Array.isArray(list);
for (const string in list) {
if (string === ip) return true; // exact match
// Quick lookup
if (!isArray) {
if (ip in list) return true; // domain or literal IP
if (isHostname) return false; // skip CIDR match
}
const cidr = string.split('/');
// Iterate: arrays and CIDR matches
for (let item in list) {
if (isArray) {
item = list[item]; // item is index
if (item === ip) return true; // exact match
}
if (isHostname) continue; // skip CIDR match
const cidr = item.split('/');
const c_net = cidr[0];

@@ -383,0 +395,0 @@

2

package.json
{
"name": "haraka-net-utils",
"version": "1.2.4",
"version": "1.3.0",
"description": "haraka network utilities",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -70,5 +70,6 @@ ![CI Linux][ci-img]

// searches for 'ip' as a hash key in the list object
// searches for 'ip' as a hash key in the list object or array
// ip can be a host, an IP, or an IPv4 or IPv6 range
net_utils.ip_in_list(object, ip);
net_utils.ip_in_list(array, ip);
net_utils.ip_in_list(tls.no_tls_hosts, '127.0.0.5');

@@ -75,0 +76,0 @@

@@ -988,3 +988,4 @@

function _check_list (done, list, ip, res) {
assert.equal(net_utils.ip_in_list(list, ip), res);
assert.equal(net_utils.ip_in_list(list, ip), res); // keys of object
assert.equal(net_utils.ip_in_list(Object.keys(list), ip), res); // array
done();

@@ -991,0 +992,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc