Skip to content

Merge CIDRs list, cleanup, and handle overlaps

License

Notifications You must be signed in to change notification settings

bepsoccer/cidr-clean-bp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cidr-clean


Build Status MIT Licence

What for ?

Clean an array of CIDR

  • remove duplicates
  • remove comments
  • remove bad CIDRs
  • remove extra spaces
  • choose the heaviest network in case of overlap

This is a fork of cidr-clean by Eviltik to make it work with an older nodejs implementation.

Installation

$ npm install cidr-clean-bp

Usage

const cidrClean = require('cidr-clean-bp');

let list = [
    '#mycomment',
    '10.1.2.0/23',
    '110.1.3.248/30',
    '1.2.3.4/10'
];

console.log(cidrClean(list));

# output: ['10.1.2.0/23', '110.1.3.248/30', '1.2.3.4/10'];

# note, you can cidrClean(list1, list2) for merging 2 cidr lists

Todo

  • optional callback with all events (remove, overlap)

About

Merge CIDRs list, cleanup, and handle overlaps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%