Open sparrc opened 8 years ago
Is there any way we could implement these in golang.org/x/net instead?
@ianlancetaylor Yes, fine with me
I don't think these are generally useful enough to be worth the complexity they would add to the API. "shouldn't be too difficult" and "could be useful" are a very low bar, much lower than what is required for addition to the standard library. If you'd like to add them to x/net/ipv4 and x/net/ipv6, I guess that's fine.
Currently there are the following setter functions in the net package for the IPConn, TCPConn, UDPConn, and UnixConn objects:
Under the covers, these all call the unix C
setsockopt()
functionSince
setsockopt
has a correspondinggetsockopt
function, I'm proposing that we add the corresponding Getter functions to thenet
package, looking something like this:This shouldn't be too difficult to implement, since the generated
zsyscall_*.go
files already have thegetsockopt
function.This could be useful for debugging and logging information, and for checking if the corresponding
Set
function needs to be called.