ipfs / go-bitswap

The golang implementation of the bitswap protocol
MIT License
216 stars 112 forks source link

Add hooks for better peer filters #596

Closed hannahhoward closed 1 year ago

hannahhoward commented 1 year ago

Goals

There's a long standing request to support limits in the server like bandwidth, simultaneous wants (total and per peer).

Without wanting to make big changes here to support this, for the time being this PR just exposes a couple additional configs and utility functions on the server implementation that would allow someone running a peer block filter to implement such limits. You can see how we use this in boost here: https://github.com/filecoin-project/boost/pull/1020

Implementation

hannahhoward commented 1 year ago

@Jorropo upon further investigation, I have determined I can get everything I want using the WithTracer option and as such, it is best not to duplicate existing functionality. At the point go-bitswap itself wants to implement the bandwidth controls we're going to use, it will make sense to reexplore, and the booster-bitswap code can serve as a reference for implementation