Documentation ¶
Overview ¶
Package memconn provides an in-memory network connections. This allows applications to connect to themselves without having to open up ports on the network.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is an in-memory net.Listener. Call DialContext to create a new connection.
func NewListener ¶
NewListener creates a new in-memory Listener.
func (*Listener) Accept ¶
Accept waits for and returns the next connection to l. Connections to l are established by calling l.DialContext.
The returned net.Conn is the server side of the connection.
func (*Listener) Close ¶
Close closes l. Any blocked Accept operations will immediately be unblocked and return errors. Already Accepted connections are not closed.
func (*Listener) DialContext ¶
DialContext creates a new connection to l. DialContext will block until the connection is accepted through a blocked l.Accept call or until ctx is canceled.
Note that unlike other Dial methods in different packages, there is no address to supply because the remote side of the connection is always the in-memory listener.