package netchan

Import Path
	go.pact.im/x/netchan (on go.dev)

Dependency Relation
	imports 4 packages, and imported by 0 packages

Involved Source Files Package netchan provides an in-memory implementation of the [net.Listener] interface, allowing programs to simulate network connections using channels and pipes instead of real network sockets.
Package-Level Type Names (total 2, in which 1 is exported)
/* sort exporteds by: | */
Listener implements the [net.Listener] interface using channels for accepting connections. Incoming connections are sent on an internal channel and accepted by Accept calls. The Listener can be closed to unblock Accept calls and signal shutdown. Accept waits for and returns the next connection sent to the listener’s connection channel. If the listener is closed, Accept returns [ErrClosed]. Addr implements the [net.Listener] interface. C returns the internal channel used to send [net.Conn] connections to the Accept callers. The returned channel should not be closed; use Close method to unblock Accept instead. Sending a nil connection on this channel is allowed and can be used to wait for the Accept caller to be ready. Close closes the listener and unblocks all Accept calls. Dial creates a new in-memory connection pair using net.Pipe and sends the server side connection to the Listener’s internal connection channel. It returns the client side connection, which can be used to communicate with the accepted connection on the Listener side. Dial blocks until the server side connection is accepted by a call to Accept, or until the Listener is closed or the provided context is canceled. Done returns a channel that is closed when the Listener is closed. *Listener : io.Closer *Listener : net.Listener func NewListener() *Listener func NewListenerAddr(addr net.Addr) *Listener
Package-Level Functions (total 2, both are exported)
NewListener returns a new Listener with the default address.
NewListenerAddr returns a new Listener instance with the specified network address.
Package-Level Variables (only one, which is exported)
ErrClosed indicates that the [Listener] has been closed and no further operations can be performed.