Documentation
¶
Overview ¶
Package socket contains platform-specific descriptor and socket operations used by UIO's native transports.
Index ¶
- func Accept(fd int) (int, syscall.Sockaddr, error)
- func Dup(fd int) (nfd int, err error)
- func DupNetConn(conn net.Conn) (int, error)
- func RecvUDP(fd int, packet []byte, receive *UDPReceive) (int, error)
- func SetIPv6Only(fd, ipv6only int) error
- func SetKeepAlive(fd int, keepalive bool) error
- func SetKeepAlivePeriod(fd int, secs int) error
- func SetLinger(fd, secs int) error
- func SetNoDelay(fd int, nodelay bool) error
- func SetNonblock(fd int, nonblocking bool) error
- func SetRecvBuffer(fd, size int) error
- func SetReuseAddr(fd, reuseAddr int) error
- func SetSendBuffer(fd, size int) error
- func SockaddrToAddr(sa syscall.Sockaddr, udpAddr bool) net.Addr
- func Writev(fd int, buffers [][]byte) (int, error)
- type UDPAddress
- type UDPReceive
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Accept ¶ added in v1.1.0
Accept creates a non-blocking descriptor that cannot leak across exec.
func DupNetConn ¶
DupNetConn duplicates conn's descriptor so UIO can assume ownership without changing the lifetime of the caller's net.Conn during handoff.
func RecvUDP ¶ added in v1.1.0
func RecvUDP(fd int, packet []byte, receive *UDPReceive) (int, error)
RecvUDP receives one datagram without allocating a Sockaddr interface.
func SetIPv6Only ¶
SetIPv6Only restricts a IPv6 socket to only process IPv6 requests or both IPv4 and IPv6 requests.
func SetKeepAlive ¶
SetKeepAlive sets whether the operating system should send keep-alive messages on the connection.
func SetKeepAlivePeriod ¶
SetKeepAlivePeriod sets period between keep-alives.
func SetLinger ¶
SetLinger sets the behavior of Close on a connection which still has data waiting to be sent or to be acknowledged.
If sec < 0 (the default), the operating system finishes sending the data in the background.
If sec == 0, the operating system discards any unsent or unacknowledged data.
If sec > 0, the data is sent in the background as with sec < 0. On some operating systems after sec seconds have elapsed any remaining unsent data may be discarded.
func SetNoDelay ¶
SetNoDelay controls whether the operating system should delay packet transmission in hopes of sending fewer packets (Nagle's algorithm).
The default is true (no delay), meaning that data is sent as soon as possible after a Write.
func SetNonblock ¶
SetNonblock set this socket to use non-blocking mode or block mode.
func SetRecvBuffer ¶
SetRecvBuffer sets the size of the operating system's receive buffer associated with the connection.
func SetReuseAddr ¶
SetReuseAddr enables SO_REUSEADDR option on socket.
func SetSendBuffer ¶
SetSendBuffer sets the size of the operating system's transmit buffer associated with the connection.
func SockaddrToAddr ¶
SockaddrToAddr returns a go/net friendly address
Types ¶
type UDPAddress ¶ added in v1.1.0
UDPAddress is a comparable source address suitable for use as a map key.
func (UDPAddress) NetAddr ¶ added in v1.1.0
func (addr UDPAddress) NetAddr() *net.UDPAddr
NetAddr allocates the user-visible address used only for a new peer.
func (UDPAddress) Sockaddr ¶ added in v1.1.0
func (addr UDPAddress) Sockaddr() syscall.Sockaddr
Sockaddr allocates the persistent send address used only for a new peer.
type UDPReceive ¶ added in v1.1.0
type UDPReceive struct {
Addr UDPAddress
// contains filtered or unexported fields
}
UDPReceive holds reusable source-address storage for RecvUDP.