Closed resession closed 2 years ago
scratch the "initially no relays" part. i added 3 peers.
'https://relay.peer.ooo/gun', 'https://gunjs.herokuapp.com/gun', 'https://fire-gun.herokuapp.com/gun'
these 3 peers are used by a lot of people which means they should be stable(meaning they will not be taken offline anytime soon)
this is better than how it was before. this way initially gundb can have access to the wider graph and not have all those outdated relay errors pop up. at the same time, p2p sites can add their own peers.
updated the module
if the relay
option is truthy, then we will try to get the peers from https://raw.githubusercontent.com/wiki/amark/gun/volunteer.dht.md, if we get a code 404 then we have a bunch of bootstrap peers. we check all of these peers one by one to make sure they are online(code 200). then we use gun.opt({peers: [finalPeersRightHere]})
if the relay
option is falsy, then we do not pass in any relay peers. meaning gun-fetch will be local-only at the start until users add relay peers.
when i use agregore, i kept get a "can not read undefined 'lackl'" error. this was a pop up and the error is coming from gundb. i think it is something to do with outdated gundb relay peers. so i introduced the HEAD http method. now a p2p site can add their own gundb relay peer by using
fetch('gun://_', {method: 'HEAD', headers: {'peer': 'https://somepeer'}})
.if this pr is accepted, what that would mean is gun-fetch at first will only be local-first. once a p2p site adds a relay peer though, then agregore's gundb instance will be connected with everyone else(gundb's wider graph). this is a very good way to not hard-code any outdated peers. and now we also give p2p site makers a choice to use their own gundb relays.