-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add static http gateway routing #515
Conversation
Adds a routing implementation that returns a static list of gateways as providers for CIDs. It's expected that these gateways are able to fetch content on our behalf.
} | ||
|
||
// these values are from https://github.com/multiformats/multicodec/blob/master/table.csv | ||
const LIBP2P_KEY_CODE = 0x72 |
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.
Does it make sense to use the code for transport-ipfs-gateway-http
instead?
const LIBP2P_KEY_CODE = 0x72 | |
const TRANSPORT_IPFS_GATEWAY_HTTP_CODE = 0x0920 |
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.
Sure, I have no strong preference here, really it just needs to be unique to allow comparison between peer identifiers.
Reading the PR that added that code the intention was for numbers to be used instead of peer protocol strings so I don't think there'll be any collision?
I'm curious, how do you plan on using the HTTPGatwayRouter once merged? |
It'll be configured like any other router and will let http gateway sessions fall back to a default set of gateways. We'll also be able to switch the gateway block broker over to use the helia routing which will let it find non-preconfigured gateways but also fall back to the default ones. |
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.
looks straightforward to me but i'm not intimately familiar with PeerId class we're implementing.
i think sync multihash is fine, toCID should be unique per URL.. ship it
Some context for @2color from chat I had with @achingbrain when talking about issues with trustless-gateways related to testing out the changes in ipfs/helia-verified-fetch#50
Essentially, we need some way to reduce the breadth of content-fetching requests (via sessions), and trustless gateways returned from delegated routing providers are not consistently reliable and frequently not available at all. When I was looking into it, I proposed having trustless gateway sessions fall back to the provided trustless-gateways passed to blockBrokers. IIUC, this PR enables a version of that fallback in the defined "routing" language we've recently moved to in helia. Alex to correct me here if I'm wrong or too imprecise. |
That's it, all good. |
Nice! Cool stuff |
Adds a routing implementation that returns a static list of gateways as providers for CIDs.
It's expected that these gateways are able to fetch content on our behalf.
Depends on:
Change checklist