Is there something similar to 'npm netmask' in golang ? I need to convert i.e. 10.0.0.0/8 to 10.0.0.0/255.0.0.0 so basically netmask in CIDR format to dot-decimal.
var Netmask = require('netmask').Netmask
var block = new Netmask('10.0.0.0/8');
block.mask; // 255.0.0.0
I can't find it in /golang.org/src/net/ip.go
The go standard library does not have a function to create that representation. That being said, it is not difficult to do yourself:
https://play.golang.org/p/XT_UXoy6ra
Keep in mind this format only works for ipv4 masks. If you were to pass an ipv6 mask, this would panic.