go-textile
go-textile copied to clipboard
Bootstrap from previous/existing peers
Right now, any peer that is shutdown and then restarted will try to bootstrap off the default bootstrap peerlist. However, given the social network nature of many Textile applications (sharing photos, files, etc), it might make more sense to attempt to connect to, and bootstrap from, peers we have previously interacted with. This has the benefit of potentially more quickly finding peers you regularly share with, which is critical in a mobile environment (fast warmup). It additionally may avoid peers trying to connect to Cafes that are difficult or even impossible to reach in some cases.
Possible way forward?
It is not immediately clear where to intercept the boostrapping step of libp2p, but there appears to be a bootstrap libp2p service that can be used? The other possibility is simply letting the default boostrapping happen, and adding an additional Textile Boostrap service connect to peers on top of/in addition to this?
A suggestion from postables
on IRC:
that functionality should really be trivial to add if you have access to
peerstore.Peerstore
and thepeerstore.Peerstore
is stored persisently somewhere, (ie usingpeerstore/pstoreds
probably would look something like:
function (s *Service) Bootstrap() {
if len(s.peerstore.GetPeers()) > 0 {
// pull individual peers, connect to them
return
}
// no peers stored so trigger default bootstrapping
return
}
See also https://github.com/libp2p/go-libp2p/issues/410 and https://github.com/ipfs/go-ipfs/blob/master/core/bootstrap/bootstrap.go#L63
Awesome, looks like RTradeLtd has built something similar (untested): https://github.com/RTradeLtd/bootstrap