local-ip-address icon indicating copy to clipboard operation
local-ip-address copied to clipboard

Feature Request: Determining Netmask

Open JustBobinAround opened this issue 1 year ago • 1 comments

This may be a feature already, I just couldn't find anything in the docs. Is there anyway to get the netmask of the ip? I am currently using this for a project to determine the UDP broadcast ip:

10  .0   .0   .5    // ip
255 .255 .255 .0    // netmask
----------------
10  .0   .0   .255    // broadcast

In most networks, I can assume the broadcast ip is just the last digit changed to 255, however if the netmask is changed, then so is the broadcast:

10  .0   .0   .5    // ip
255 .255 .0   .0    // netmask
----------------
10  .0   .255 .255    // broadcast

JustBobinAround avatar Feb 20 '24 01:02 JustBobinAround

Hey @JustBobinAround!

Thanks so much for openning this issue!

I think this is a great addition to this library, do you feel like giving it a try?

LeoBorai avatar Feb 20 '24 01:02 LeoBorai