xnet/pipenet: Package for TCP-like synchronous in-memory network of net.Pipes
This patch adds pipenet - virtual network of net.Pipes. Addresses on pipenet are host:port pairs. A host is xnet.Networker and so can be worked with similarly to regular TCP network with Dial/Listen/Accept/... Example: net := pipenet.New("") h1 := net.Host("abc") h2 := net.Host("def") l, err := h1.Listen(":10") // starts listening on address "abc:10" go func() { csrv, err := l.Accept() // csrv will have LocalAddr "abc:10" }() ccli, err := h2.Dial("abc:10") // ccli will have RemoteAddr "def:10" Pipenet might be handy for testing interaction of networked applications in 1 process without going to OS networking stack.
Showing
xnet/pipenet/pipenet.go
0 → 100644
xnet/pipenet/pipenet_test.go
0 → 100644