go-bitswap
go-bitswap copied to clipboard
Docs On Initializing And Using Bitswap In Readme
It would be great to demonstrate how to setup and use bitswap in the Readme.
This would include initialization:
- creating a libp2p host (can use mocknet for example purposes)
- setting up a bitswap network interface (from Libp2p host -- see network/ipfs_impl.go)
- initializing a blockstore
- creating an instance of bitswap from context, blockstore, and network interface (may want to look at GraphSync README for model for this part) (github.com/ipfs/go-graphsync)
Use Bitswap, Including:
- Request a block with GetBlock
- Request multiple blocks with GetBlocks
- Indicate you have a block with HasBlock
- Get information with WantlistForPeer / LedgerForPeer
- Create a Session (w/ NewSession)
- GetBlocks from a session
This would be awesome!