Js-ipfs: Peer Friends

Created on 22 Jul 2019  路  5Comments  路  Source: ipfs/js-ipfs

Can we come up with a solution and track progress on peer "friends" in IPFS?

What is that?

The idea is that friendly peers maintain a persistent connection with each other that is immune from connection manager GC.

Why is it useful?

  1. Preload nodes used by JS IPFS will preload content but are not useful to the JS IPFS node if it is not connected to them
  2. The IPFS gateway could really use a persistent connection to the cluster nodes (currently a cron job calling swarm.connect)
  3. Probably lots of applications using IPFS would like to stay connected to a minimum set of nodes

What would need to happen?

Proposal (open to suggestions/changes):

  • [ ] Ability to dial a node and flag that the connection is "high priority"

    • Should be established ASAP

    • Always re-establish if dropped

    • Be immune from connection manager GC

  • [ ] Config option to specify multiple friendly peers

    • Addresses.Friends

  • [ ] Startup task to dial all the friendly peers

@lidel @Stebalien @daviddias @jacobheun @raulk @olizilla

P3 dihard exploration statuready

Most helpful comment

"Bungee Cord Peers" ?

All 5 comments

Relevant prior art form go-ipfs: v0.4.20 shipped a concept of "important" connections:

The ipfs swarm connect command 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" ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ya7ya picture ya7ya  路  3Comments

OliverUv picture OliverUv  路  3Comments

daviddias picture daviddias  路  3Comments

valmack picture valmack  路  3Comments

daviddias picture daviddias  路  3Comments