ipfs-swarm-bind-shim
A poor mans shim for a missing swarm.bind command
Stay connected to a minimum number of peers. Periodically checks for connectivity and if not connected to the minimum it'll (re)connect.
⚠️ No tests yet! Might not even work!
Install
npm install ipfs-swarm-bind-shim
Usage
const swarmBind =
Example
// addresses of peers we want to stay connected to// n.b. must include peer ID!const addrs = '/ip4/127.0.0.1/tcp/63372/p2p/QmXGb4JumMVSFc66Fz6q3XiUQbGdyU4WCHjrLykQD9p8SQ' '/ip4/127.0.0.1/tcp/63362/p2p/QmeqriW5H3G7KBo41U3pTyNdCq5iE19SH4oVeuxAQ3iHz2' '/ip4/127.0.0.1/tcp/63391/p2p/QmbtWfdGpeT9YVWZ4gajg2c4hA1UVrgqiFuLF2CgJmGv23' const cancel = await // ipfs will now be connected to minConnections peers// and will monitor and re-connect. // later... // unbind (stop checking and connecting)
Contribute
Feel free to dive in! Open an issue or submit PRs.
License
MIT © Alan Shaw