// NewFromIpfsHost returns a BitSwapNetwork supported by underlying IPFS host func NewFromIpfsHost(host host.Host, r routing.ContentRouting) BitSwapNetwork { bitswapNetwork := impl{ host: host, routing: r, } host.SetStreamHandler(ProtocolBitswap, bitswapNetwork.handleNewStream) host.SetStreamHandler(ProtocolBitswapOne, bitswapNetwork.handleNewStream) host.SetStreamHandler(ProtocolBitswapNoVers, bitswapNetwork.handleNewStream) host.Network().Notify((*netNotifiee)(&bitswapNetwork)) // TODO: StopNotify. return &bitswapNetwork }