package fasthttputil

Import Path
	github.com/valyala/fasthttp/fasthttputil (on go.dev)

Dependency Relation
	imports 5 packages, and imported by one package

Involved Source Files Package fasthttputil provides utility functions for fasthttp. inmemory_listener.go pipeconns.go
Package-Level Type Names (total 2)
/* sort by: | */
InmemoryListener provides in-memory dialer<->net.Listener implementation. It may be used either for fast in-process client<->server communications without network stack overhead or for client<->server tests. Accept implements net.Listener's Accept. It is safe calling Accept from concurrently running goroutines. Accept returns new connection per each Dial call. Addr implements net.Listener's Addr. Close implements net.Listener's Close. Dial creates new client<->server connection. Just like a real Dial it only returns once the server has accepted the connection. It is safe calling Dial from concurrently running goroutines. DialWithLocalAddr creates new client<->server connection. Just like a real Dial it only returns once the server has accepted the connection. The local address of the client connection can be set with local. It is safe calling Dial from concurrently running goroutines. SetLocalAddr sets the (simulated) local address for the listener. *InmemoryListener : io.Closer *InmemoryListener : net.Listener func NewInmemoryListener() *InmemoryListener
PipeConns provides bi-directional connection pipe, which use in-process memory as a transport. PipeConns must be created by calling NewPipeConns. PipeConns has the following additional features comparing to connections returned from net.Pipe(): - It is faster. - It buffers Write calls, so there is no need to have concurrent goroutine calling Read in order to unblock each Write call. - It supports read and write deadlines. PipeConns is NOT safe for concurrent use by multiple goroutines! Close closes pipe connections. Conn1 returns the first end of bi-directional pipe. Data written to Conn1 may be read from Conn2. Data written to Conn2 may be read from Conn1. Conn2 returns the second end of bi-directional pipe. Data written to Conn2 may be read from Conn1. Data written to Conn1 may be read from Conn2. SetAddresses sets the local and remote addresses for the connection. *PipeConns : io.Closer func NewPipeConns() *PipeConns
Package-Level Functions (total 2)
NewInmemoryListener returns new in-memory dialer<->net.Listener.
NewPipeConns returns new bi-directional connection pipe. PipeConns is NOT safe for concurrent use by multiple goroutines!
Package-Level Variables (total 2)
ErrInmemoryListenerClosed indicates that the InmemoryListener is already closed.
ErrTimeout is returned from Read() or Write() on timeout.