ip-address
ip-address copied to clipboard
Add examples to documentation
I can't see how I can get CIDR prefix length (bits) of an IPv6 subnet. I have the IP address and the subnet mask. Is it even possible with this lib?
Also to get the first and last IPv6 in a subnet, you have .startAddress()
and endAddress()
methods but I cannot get a valid result from them.
But both start and end returns ffff:ffff:ffff:ffff:0000:0000:0000:0000
re: 1., given a mask like 0000:0000:0000:0000:ffff:ffff:ffff:ffff
are you looking for a function that returns 64
?
re: 2., here's a working example: http://requirebin.com/?gist=982bc23a191d601dca5b53b5ef7e7403
point taken re: adding examples to the documentation though. happy to merge any documentation PRs if you get to them before I do! ✨
- Exactly. We should either be getting CIDR or bits (so we can get CIDR via
128 - bits
) - Thanks for the example. See, for example Node's
os.networkInterfaces()
returns IPv6 subnet mask in address form, not CIDR. so to init an IPv6 likenew ip.Address6('1:2:3:4::/64')
I should be able to convert from address/mask form to CIDR.
ah, thanks for the pointer to os.networkInterfaces()
; I'll add this soon!
any news on this (conversion from address/mask form to CIDR)?
btw, cannot reach documentation @ ip-address.js.org
can you try ip-address.js.org again? it's working for me
re: the conversion; i'm work on a function for you right now
@onury can you see if this meets your needs?
http://requirebin.com/?gist=7b4a2156b1f783ede271e68eaf44d281
if it does, i'll flesh it out further and add it to the library :)
I think so. thanks. docs are working again.