This is the first release of package socket that only supports Go 1.21+. Users on older versions of Go must use v0.4.1.
socket.Conn wrappers for various Getsockopt and
Setsockopt system calls.socket.Conn can be used with non-socket file descriptors by handling
ENOTSOCK in the constructor.This is the first release of package socket that only supports Go 1.18+. Users on older versions of Go must use v0.3.0.
x/sys and other dependencies.This is the last release of package socket that supports Go 1.17 and below.
socket.Conn methods now support context cancelation. Future
releases will continue adding support as needed.
ReadContext and WriteContext methods.Connect, Recvfrom, Recvmsg, Sendmsg, and Sendto methods now accept
a context.Sendto parameter order was also fixed to match the underlying syscall.socket.Conn has new Pidfd* methods for wrapping the pidfd_*(2) family of
system calls.socket.Conn has new IoctlKCM* methods for wrapping ioctl(2) for AF_KCM
operations.socket.Conn has a new SetsockoptPacketMreq method for wrapping
setsockopt(2) for AF_PACKET socket options.socket.FileConn can be used to create a socket.Conn from an existing
os.File, which may be provided by systemd socket activation or another
external mechanism.socket.Conn.Connect now returns the unix.Sockaddr value provided by
getpeername(2), since we have to invoke that system call anyway to verify
that a connection to a remote peer was successfully established.unix.GetsockoptInt in the socket.Conn.Connect
method. Thanks @vcabbage!socket.Conn.Connect now properly checks the SO_ERROR socket
option value after calling connect(2) to verify whether or not a connection
could successfully be established. This means that Connect should now report
an error for an AF_INET TCP connection refused or AF_VSOCK connection
reset by peer.socket.Conn.Getpeername for use in Connect, but also for
use by external callers.socket.Conn now has CloseRead, CloseWrite, and Shutdown
methods.netlink.