net-io

(after #442)

This PR changes net to use `io` instead of channels.
At the moment it's just `conn`, but soon more.
> Silly me. I tried to run it. Panics.

Shouldn't panic anymore.

> Less is more, ya know?

??? it's not that big. and half the methods are syntactic sugar.

I need this interface for the kinds of tests I want to run. You can wrap
Mocknet with another, more constrained interface if you feel like it's too
much.

On Wed, Dec 17, 2014 at 7:07 AM, Brian Tiger Chow <notifications@github.com>
wrote:
>
> In net/mock/mock.go
> <https://github.com/jbenet/go-ipfs/pull/443#discussion-diff-21976860>:
>
> > +func (c *Conn) RemotePeer() peer.Peer {
> > +	return c.remote.local
> > +}
> > +
> > +// network implements the Network interface,
> > +type Network struct {
> > +	local peer.Peer // local peer
> > +	mux   inet.Mux  // protocol multiplexing
> > +
> > +	conns map[peer.Peer]*Conn
> > +	sync.RWMutex
> > +
> > +	cg ctxgroup.ContextGroup // for Context closing
> > +}
> > +
> > +func MakeNetworks(ctx context.Context, peers []peer.Peer) (nets []*Network, err error) {
>
>  It builds but doesnt work yet (or at least i dont think it does).
>
> Silly me. I tried to run it. Panics. At least there's a test in place.
> #461 <https://github.com/jbenet/go-ipfs/pull/461>
>
> You really went all out with the interface. Less is more, ya know?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jbenet/go-ipfs/pull/443/files#r21976860>.
>