ip-cidr
ip-cidr copied to clipboard
IP Range to CIDR
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
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, Oh yeah , that was by mistake. I was actually expecting the array of CIDRs.