- [Improvement]: revert
go.mod
to Go 1.20 to resolve an issue around Go module version upgrades.
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.
- [Improvement]: drop support for older versions of Go.
- [New API]: add
socket.Conn
wrappers for variousGetsockopt
andSetsockopt
system calls.
- [Bug Fix] commit:
ensure
socket.Conn
can be used with non-socket file descriptors by handlingENOTSOCK
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.
- [Improvement]: drop support for older versions of Go so we can begin using
modern versions of
x/sys
and other dependencies.
This is the last release of package socket that supports Go 1.17 and below.
- [New API/API change] PR:
numerous
socket.Conn
methods now support context cancelation. Future releases will continue adding support as needed.- New
ReadContext
andWriteContext
methods. Connect
,Recvfrom
,Recvmsg
,Sendmsg
, andSendto
methods now accept a context.Sendto
parameter order was also fixed to match the underlying syscall.
- New
- [New API] commit:
socket.Conn
has newPidfd*
methods for wrapping thepidfd_*(2)
family of system calls.
- [New API] commit:
socket.Conn
has newIoctlKCM*
methods for wrappingioctl(2)
forAF_KCM
operations.
- [New API] commit:
socket.Conn
has a newSetsockoptPacketMreq
method for wrappingsetsockopt(2)
forAF_PACKET
socket options.
- [New API] commit:
socket.FileConn
can be used to create asocket.Conn
from an existingos.File
, which may be provided by systemd socket activation or another external mechanism. - [API change] commit:
socket.Conn.Connect
now returns theunix.Sockaddr
value provided bygetpeername(2)
, since we have to invoke that system call anyway to verify that a connection to a remote peer was successfully established. - [Bug Fix] commit:
check the correct error from
unix.GetsockoptInt
in thesocket.Conn.Connect
method. Thanks @vcabbage!
- [Bug Fix]:
socket.Conn.Connect
now properly checks theSO_ERROR
socket option value after callingconnect(2)
to verify whether or not a connection could successfully be established. This means thatConnect
should now report an error for anAF_INET
TCP connection refused orAF_VSOCK
connection reset by peer. - [New API]: add
socket.Conn.Getpeername
for use inConnect
, but also for use by external callers.
- [New API]:
socket.Conn
now hasCloseRead
,CloseWrite
, andShutdown
methods. - [Improvement]: internal rework to more robustly handle various errors.
- Initial unstable release. Most functionality has been developed and ported
from package
netlink
.