Documentation ¶
Index ¶
- func TCPConnFileWrap(wrapped any) (wrapperFile *os.File, ctxCancel context.Context, err error)
- func TCPConnPair(address ...string) (c1, c2 *net.TCPConn, err error)
- func TCPConnWrap(wrapped any) (wrapperConn *net.TCPConn, ctxCancel context.Context, err error)
- func UnixConnFileWrap(wrapped any) (wrapperFile *os.File, ctxCancel context.Context, err error)
- func UnixConnPair(path ...string) (*net.UnixConn, *net.UnixConn, error)
- func UnixConnWrap(wrapped any) (wrapperConn *net.UnixConn, ctxCancel context.Context, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TCPConnFileWrap ¶
TCPConnFileWrap wraps an object into a *os.File from an underlying net.TCPConn. The object must implement io.Reader and/or io.Writer.
If the object implements io.Reader, upon completing copying the object to the returned *os.File, the callback functions will be called.
It is caller's responsibility to close the returned *os.File.
func TCPConnPair ¶
TCPConnPair returns a pair of connected net.TCPConn.
func TCPConnWrap ¶
TCPConnWrap wraps an io.Reader/io.Writer/io.Closer interface into a TCPConn.
This function spins up goroutine(s) to copy data between the ReadWrite(Close)r and the TCPConn. Anything written to the TCPConn by caller will be written to the wrapped object if the object implements io.Writer, and if the object implements io.Reader, anything read by goroutine from the wrapped object will be readable from the TCPConn by caller.
Once this function is invoked, the caller should not perform I/O operations on the wrapped connection anymore.
The returned context.Context can be used to check if the connection is still alive. If the connection is closed, the context will be canceled.
func UnixConnFileWrap ¶
UnixConnFileWrap wraps an object into a *os.File from an underlying net.UnixConn. The object must implement io.Reader and/or io.Writer.
If the object implements io.Reader, upon completing copying the object to the returned *os.File, the callback functions will be called.
It is caller's responsibility to close the returned *os.File.
func UnixConnPair ¶
UnixConnPair returns a pair of connected net.UnixConn.
func UnixConnWrap ¶
UnixConnWrap wraps an io.Reader/io.Writer/io.Closer interface into a UnixConn.
This function spins up goroutine(s) to copy data between the ReadWrite(Close)r and the UnixConn. Anything written to the UnixConn by caller will be written to the wrapped object if the object implements io.Writer, and if the object implements io.Reader, anything read by goroutine from the wrapped object will be readable from the UnixConn by caller.
Once this function is invoked, the caller should not perform I/O operations on the wrapped connection anymore.
The returned context.Context can be used to check if the connection is still alive. If the connection is closed, the context will be canceled.
Types ¶
This section is empty.