The function is really just looking up the IP prefixes of the non-routeable 
address ranges. It has nothing to do with CIDR, it is for generating a sane 
default mask when the user has not specified the mask.

It most definitely should not be deprecated, as these nonrouteable 
addresses are definitely not deprecated, and CIDR is an extension, not a 
replacement, for IPv4 subnet specification, to give administrators more 
flexibliity when configuring multiple address ranges in a fairly large 
intranet.

On Saturday, 2 March 2019 22:32:28 UTC+1, John Dreystadt wrote:
>
> I am new to Go so feel free to point out if I am breaking protocol but I 
> ran into the function DefaultMask() in the net package and did some 
> research. This function returns the IPMask by assuming that you are using 
> IP class A, B, and C addresses. But this concept is from the early days of 
> the Internet, and was superseded by CIDR in 1993. See 
> https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing for the 
> history here. I looked around both this group and on Stack Overflow to see 
> what people had posted about this function. The only reference in 
> golang-nuts was to someone using this call to decide if an address was IPv4 
> or not. As the last posting on that thread pointed out, you can use To4() 
> for the same purpose (since DefaultMask actually calls To4). The only 
> reference on Stack Overflow was someone using it to get the "Next IP 
> address". Sorry but I don't understand what he was doing. If you want the 
> IPMask for 127.0.0.1, you can just get that interface and get the mask that 
> way. I even tried Google for "golang DefaultMask" and only found hits about 
> non network things. So I don't believe that this function is useful today 
> and should be deprecated, maybe with a message about using To4() if you 
> just want to see if an address is IPv4.
>

-- 
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.

Reply via email to