API/api.medcify.app/node_modules/netmask/example/ipcalc.coffee

17 lines
442 B
CoffeeScript
Raw Normal View History

2022-09-26 06:11:44 +00:00
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()