>> >> >>> On Thursday, 2 May 2019 14:09:09 UTC+2, Louki Sumirniy wrote: >>> The function has a very specific purpose that I have encountered in several >>> applications, that being to automatically set the netmask based on the IP >>> being one of the several defined ones, 192, 10, and i forget which others. >>> >>> Incorrect netmask can result in not recognising a LAN address that is >>> incorrect. A 192.168 network has 255 available addresses. You can't just >>> presume to make a new 192.168.X... address with a /16, as no other >>> correctly configured node in the LAN will be able to route to it due to it >>> being a /16. >>> >>> If you consider the example of an elastic cloud type network environment, >>> it is important that all nodes agree on netmask or they will become >>> (partially) disconnected from each other. An app can be spun up for a few >>> seconds and grab a new address from the range, this could be done with a >>> broker (eg dhcp), but especially with cloud, one could use a /8 address >>> range and randomly select out of the 16 million possible, a big enough >>> space that random generally won't cause a collision - which is a cheaper >>> allocation procedure than a list managing broker, and would be more suited >>> to the dynamic cloud environment. >>> >>> This function allows this type of client-side decisionmaking that a broker >>> bottlenecks into a service, creating an extra startup latency cost. A >>> randomly generated IP address takes far less time than sending a request to >>> a centralised broker and receiving it. >>> >>> That's just one example I can think of where a pre-made list of netmasks is >>> useful, I'm sure more experienced network programmers can rattle off a >>> laundry list. >>>
While I kind of see your point, it still seems odd that you want a function for this that is in the main net package. I would expect most if not all applications doing dynamic assignment to pick one address range and then use a fixed netmask. I just think that very few programmers will need such a function so I don’t think Go, with its emphasis on simplicity, so have it. > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.