sockopts

package
v1.92.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2025 License: BSD-3-Clause Imports: 4 Imported by: 0

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"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL