Can we come up with a solution and track progress on peer "friends" in IPFS?
The idea is that friendly peers maintain a persistent connection with each other that is immune from connection manager GC.
swarm.connect)Proposal (open to suggestions/changes):
Addresses.Friends@lidel @Stebalien @daviddias @jacobheun @raulk @olizilla
Relevant prior art form go-ipfs: v0.4.20 shipped a concept of "important" connections:
The
ipfs swarm connectcommand has a few new features:It now marks the newly created connection as "important". This should ensure that the connection manager won't come along later and close the connection if it doesn't think it's being used.
I created an issue in js-libp2p that discusses peer tagging to achieve this, https://github.com/libp2p/js-libp2p/issues/369. We could take the list from Addresses.Friends and tag them as "important" so we can get the auto connect and connection "permanence" logic in place.
Another approach I started thinking about was adding support for definable topologies. While more generic, I think they could serve this use case as well.
I suggest calling this config value something more informative than Friends. Nothing occurs now though 馃槄
The Conn Manager should be the piece of code that handles this.
Note, today you can achieve 90% of this today by adding these peers to the Bootstrap list, as it will try to reconnect if the connection got dropped every 10s https://github.com/libp2p/js-libp2p-bootstrap/blob/master/src/index.js#L40 (the other 10% is because the connections do get dropped, which means you need to pay the cost of dialing again)
"Bungee Cord Peers" ?
Related: https://github.com/ipfs/go-ipfs/issues/6097#issuecomment-506964185
Most helpful comment
"Bungee Cord Peers" ?