Documentation
¶
Overview ¶
Package sockopts contains logic for applying socket options.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetBufferSize ¶
func SetBufferSize(pconn nettype.PacketConn, direction BufferDirection, size int) (errForce error, errPortable error)
SetBufferSize sets pconn's buffer to size for direction. It attempts (errForce) to set SO_SNDBUFFORCE or SO_RECVBUFFORCE which can overcome the limit of net.core.{r,w}mem_max, but require CAP_NET_ADMIN. It falls back to the portable implementation (errPortable) if that fails, which may be silently capped to net.core.{r,w}mem_max.
If pconn is not a *net.UDPConn, then SetBufferSize is no-op.
func SetICMPErrImmunity ¶
func SetICMPErrImmunity(pconn nettype.PacketConn) error
SetICMPErrImmunity is no-op on non-Windows.
Types ¶
type BufferDirection ¶
type BufferDirection string
BufferDirection represents either the read/receive or write/send direction of a socket buffer.
const ( ReadDirection BufferDirection = "read" WriteDirection BufferDirection = "write" )
Click to show internal directories.
Click to hide internal directories.