darsyn / ip

Immutable value object for IPv4 and IPv6 addresses, including helper methods and Doctrine support.
http://darsyn.github.io/ip/
MIT License
245 stars 21 forks source link

Default gateway #47

Closed TheJenne18 closed 6 years ago

TheJenne18 commented 6 years ago

Hello,

Is it possible to add the feature to receive a default gateway from a subnet?

Same as we can to with getNetworkIp and getBroadcastIp.

Basically it is the network address + 1.

zanbaldwin commented 6 years ago

Should be simple enough as I believe it's just a bitwise OR operation, I'll look into this!

zanbaldwin commented 6 years ago

So after a month of looking for a solution to this I cannot find any way to add two binary strings together! Because IPv6 are 128-bit numbers, the only way I've found is moontoast/math and I don't particularly want to add dependencies to do one piece of processing. If more reasons come up to use it I might add it as a suggestion :+1: (unless you have any other suggestions for adding two 128-bit binary strings together)