silverwind / cidr-tools

Tools to work with IPv4 and IPv6 CIDR
98 stars 10 forks source link

Convert a range of IPs into CIDR #23

Open Sf298 opened 3 months ago

Sf298 commented 3 months ago

Hello I needed a function that can convert a range of IPs (192.168.0.1-192.168.0.33) into a list of CIDR formats (192.168.0.1/32, 192.168.0.2/31, 192.168.0.4/30, 192.168.0.8/29, 192.168.0.16/28, 192.168.0.32/31). I couldn't find a JS library to do it anywhere (I may have been bad at looking) so I made one myself. If you like, I can try make a PR and add it into this library or I could post my code here and let you handle it?