I am looking for something like python's netaddr.IPNetwork in node.js. Basically, i have IP network addresses like 1.1.1.1/30, 1::/128 and want to validate in the backend in express if the data provided by user is valid ip network?
Thanks,
found a good library: https://github.com/whitequark/ipaddr.js
var ipaddr = require('ipaddr.js');
var addr = ipaddr.parse("2001:db8:1234::1");
var range = ipaddr.parse("2001:db8::");
addr.match(range, 32); // => true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With