Newer
Older
vue-indexer / node_modules / netmask / example / ipcalc.coffee
@eugene-sukhodolskiy eugene-sukhodolskiy on 24 Sep 442 bytes v1.0
Netmask = require('netmask').Netmask

ip = process.argv[2]
netmask = new Netmask(ip)

out = console.log
out "Address: #{ip.split('/', 1)[0]}"
out "Netmask: #{netmask.mask} = #{netmask.bitmask}"
out "Wildcard: #{netmask.hostmask}"
out "=>"
out "Network: #{netmask.base}/#{netmask.bitmask}"
out "HostMin: #{netmask.first}"
out "HostMax: #{netmask.last}"
out "Broadcast: #{netmask.broadcast}"
out "Hosts/Net: #{netmask.size}"

out netmask.next()