 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
      Index ¶
Constants ¶
const ( SockOptSO uint = 1 << iota SockOptIP SockOptIPV6 SockOptTCP SockOptUDP )
const ( SO_BINDTOIFINDEX = 0x3e SO_REUSEPORT = 0xf SO_ZEROCOPY = 0x3c IP_BIND_ADDRESS_NO_PORT = 0x18 IP_LOCAL_PORT_RANGE = 0x33 TCP_FASTOPEN = 0x17 TCP_FASTOPEN_CONNECT = 0x1e TCP_USER_TIMEOUT = 0x12 UDP_CORK = 0x1 UDP_GRO = 0x68 UDP_SEGMENT = 0x67 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ControlFunc ¶
ControlFunc is the function type that handle RawConn.
type Controller ¶
Controller is a function type that controls socket.
type SockIPOption ¶
type SockIPOption struct {
	BindAddressNoPort   bool   // IP_BIND_ADDRESS_NO_PORT (since Linux 4.2)
	FreeBind            bool   // IP_FREEBIND (since Linux 2.4)
	LocalPortRangeUpper uint16 // IP_LOCAL_PORT_RANGE (since Linux 6.3)
	LocalPortRangeLower uint16 // IP_LOCAL_PORT_RANGE (since Linux 6.3)
	Transparent         bool   // IP_TRANSPARENT (since Linux 2.6.24)
	TTL                 int    // IP_TTL (since Linux 1.0)
}
    SockIPOption is socket options for IPPROTO_IP level.
func (*SockIPOption) Controllers ¶
func (c *SockIPOption) Controllers() []Controller
type SockIPV6Option ¶
type SockIPV6Option struct {
	V6Only bool // IPV6_V6ONLY (since Linux 2.4.21 and 2.6)
}
    SockIPV6Option is socket options for IPPROTO_IPV6 level.
func (*SockIPV6Option) Controllers ¶
func (c *SockIPV6Option) Controllers() []Controller
type SockOption ¶
type SockOption struct {
	SO   *SockSOOption
	IP   *SockIPOption
	IPV6 *SockIPV6Option
	TCP  *SockTCPOption
	UDP  *SockUDPOption
}
    SockOption is aggregated socket options.
- https://man7.org/linux/man-pages/man7/socket.7.html
- https://man7.org/linux/man-pages/man7/ip.7.html
- https://man7.org/linux/man-pages/man7/ipv6.7.html
- https://man7.org/linux/man-pages/man7/tcp.7.html
- https://man7.org/linux/man-pages/man7/udp.7.html
func (*SockOption) ControlFunc ¶
func (o *SockOption) ControlFunc(opts uint) ControlFunc
ControlFunc returns a control function from options. Only specified options are enabled. For example, pass the SockOptSO and SockOptIP to enable both options as shown below.
ControlFunc(zsyscall.SockOptSO|zsyscall.SockOptIP)
type SockSOOption ¶
type SockSOOption struct {
	BindToIFindex      int           // SO_BINDTOIFINDEX
	BindToDevice       string        // SO_BINDTODEVICE
	Debug              bool          // SO_DEBUG
	KeepAlive          bool          // SO_KEEPALIVE
	Linger             int32         // SO_LINGER
	Mark               int           // SO_MARK (since Linux 2.6.25)
	ReceiveBuffer      int           // SO_RCVBUF
	ReceiveBufferForce int           // SO_RCVBUFFORCE (since Linux 2.6.14)
	ReceiveTimeout     time.Duration // SO_RCVTIMEO
	SendTimeout        time.Duration // SO_SNDTIMEO
	ReuseAddr          bool          // SO_REUSEADDR
	ReusePort          bool          // SO_REUSEPORT (since Linux 3.9)
	SendBuffer         int           // SO_SNDBUF
	SendBufferForce    int           // SO_SNDBUFFORCE (since Linux 2.6.14)
}
    SockSOOption is socket options for SOL_SOCKET level.
- https://man7.org/linux/man-pages/man7/socket.7.html
- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
func (*SockSOOption) Controllers ¶
func (c *SockSOOption) Controllers() []Controller
type SockTCPOption ¶
type SockTCPOption struct {
	CORK            bool  // TCP_CORK (since Linux 2.2)
	DeferAccept     int   // TCP_DEFER_ACCEPT (since Linux 2.4)
	KeepCount       int   // TCP_KEEPCNT (since Linux 2.4)
	KeepIdle        int   // TCP_KEEPIDLE (since Linux 2.4)
	KeepInterval    int   // TCP_KEEPINTVL (since Linux 2.4)
	Linger2         int32 // TCP_LINGER2 (since Linux 2.4)
	MaxSegment      int   // TCP_MAXSEG
	NoDelay         bool  // TCP_NODELAY
	QuickAck        bool  // TCP_QUICKACK (since Linux 2.4.4)
	SynCount        int   // TCP_SYNCNT (since Linux 2.4)
	UserTimeout     int   // TCP_USER_TIMEOUT (since Linux 2.6.37)
	WindowClamp     int   // TCP_WINDOW_CLAMP (since Linux 2.4)
	FastOpen        bool  // TCP_FASTOPEN (since Linux 3.6)
	FastOpenConnect bool  // TCP_FASTOPEN_CONNECT (since Linux 4.11)
}
    SockTCPOption is socket options for IPPROTO_TCP level.
func (*SockTCPOption) Controllers ¶
func (c *SockTCPOption) Controllers() []Controller
type SockUDPOption ¶
type SockUDPOption struct {
	CORK    bool // UDP_CORK (since Linux 2.5.44)
	Segment int  // UDP_SEGMENT (since Linux 4.18)
	GRO     bool // UDP_GRO (since Linux 5.0)
}
    SockUDPOption is socket options for IPPROTO_UDP level.
func (*SockUDPOption) Controllers ¶
func (c *SockUDPOption) Controllers() []Controller
type SocketError ¶
SocketError is an error type that tells an application of a socket option failed.
func (*SocketError) Error ¶
func (e *SocketError) Error() string
func (*SocketError) Is ¶
func (e *SocketError) Is(err error) bool