Some stuff commonly used made more simple.
socketpair
Calling
pair, err := unixconn.Pair()
Allows pair to contain two *net.UnixConn
that are connected to each other.
Those can be used as replacement to TCP connections in test code, for example.
cred
Golang already makes this easier thanks to GetsockoptUcred
but I feel this
can be even better.
uid, gid, pid, err := unixconn.Cred(c)
NOTE: Using unixconn.Cred()
on a connection generated by
unixconn.Pair()
will return the information at the time the call to Pair()
happened, and may not reflect the right information if for example the socket
was passed to a child process.