-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add delegate routers to libp2p config #2195
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the hostnames be in config?
Otherwise LGTM 👍
Yeah, we should probably have the multiaddrs in there and then pull out the http endpoints. This will cause the config to deviate from go, as we'll likely add a new address field like Does Addresses: {
...
Delegates: [
'/dns4/node0.delegate.ipfs.io/tcp/443/https',
'/dns4/node1.delegate.ipfs.io/tcp/443/https'
]
} |
|
I've updated this to only add delegated routing if the delegates multiaddrs are actually added to the Config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry just noticed the link to the example is not working when rendered.
Separately the example says this depends on a branch of go ipfs - does it still?
Also, we need to document in the example what API endpoints need to be exposed on a go ipfs node for this to work.
License: MIT Signed-off-by: Alan Shaw <[email protected]>
6ecbdc4
to
d36cf47
Compare
@jacobheun I fixed the link and rebased |
Adds Delegates as optional array in node config. Context: #2195 License: MIT Signed-off-by: Marcin Rataj <[email protected]>
This PR adds `Addresses.Delegates` (added in #2195) as an optional array to the schema used for config validation. It fixes the error below: ![2019-07-12--21-00-53](https://user-images.githubusercontent.com/157609/61152758-92e00180-a4e9-11e9-8ef1-c6c1200575ee.png) ps. I tested it in Brave (embedded js-ipfs + preload nodes) and delegated DHT queries produce expected responses 👌 > ![2019-07-12--21-27-35](https://user-images.githubusercontent.com/157609/61153580-eeab8a00-a4eb-11e9-9152-0dcb51e2a67d.png) > ![2019-07-12--21-27-52](https://user-images.githubusercontent.com/157609/61153579-eeab8a00-a4eb-11e9-8478-71f68d3330d4.png) License: MIT Signed-off-by: Marcin Rataj <[email protected]>
Adds the delegate routing modules needed for #2155.
This enables js-ipfs nodes to leverage external nodes to provide content, find content, and find peers.
I added a crude randomizer for the preload nodes which are supporting delegate routing. Ideally this would be per request, but the modules will need to be updated to take multiple hosts to do so.
A note: If the DHT is enabled on your node, libp2p will attempt to perform the action using the DHT first. If that is not successful, it will then use the delegates to perform the request. This gives nodes the ability to fallback to the external nodes while they are building up their DHT records/peers.