Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
Conn extends net.UnixConn with additional useful methods.
func FromFile ¶
FromFile attempts to create a Conn from a file. The returned conn is independent from the file and closing one does not close the other.
func NewSocketpair ¶
func NewSocketpair(t SocketType) (left, right *Conn, err error)
NewSocketpair creates a unix socket pair, returning the halves as files.
func (*Conn) ReadWithFDs ¶
ReadWithFDs reads data and associated fds. Note that the underlying socket must be a datagram socket if you need the bytes read to exactly match the bytes sent with the FDs.
func (*Conn) WriteWithFDs ¶
WriteWithFDs performs a write that may also send associated FDs. Note that unless the underlying socket is a datagram socket it is not guaranteed that the exact bytes written will match the bytes received with the fds on the reader side.
type SocketType ¶
type SocketType int
SocketType encodes the type of desired socket (datagram or stream).
const ( // SocketTypeDatagram indicates that the socket type should be a unix datagram. Most usecases should // prefer stream sockets, but datagram can be beneficial when passing fds since it lets you ensure that // the bytes you receive alongside the fds exactly match those sent with the fds. SocketTypeDatagram SocketType = syscall.SOCK_DGRAM // SocketTypeStream indicates the the socket type should be a streaming socket. This is a reasonable default // for most usecases, though datagram may be preferable if fd passing is being used. SocketTypeStream SocketType = syscall.SOCK_STREAM )