ip-cidr icon indicating copy to clipboard operation
ip-cidr copied to clipboard

IP Range to CIDR

Open tangent-q opened this issue 3 years ago • 2 comments

Would be nice to have a method to convert IP range to CIDR.

Something like

const cidr = IPCIDR.fromRange('255.255.255.0', '255.255.255.255')
cidr instanceof IPCIDR // true
cidr.cidr // 255.255.255.128/24

tangent-q avatar May 25 '22 04:05 tangent-q

You can't always get one cidr address from random ip addresses. Mostly it's gonna be a list(chain) of CIDR's. A bit complicated. Maybe I will implement it, not sure.

ortexx avatar May 25 '22 08:05 ortexx

@ortexx, Oh yeah , that was by mistake. I was actually expecting the array of CIDRs.

tangent-q avatar May 25 '22 09:05 tangent-q