-
Notifications
You must be signed in to change notification settings - Fork 110
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: enable customising delegated http router #654
Conversation
export function delegatedHTTPRouting (url: string | URL, init: DelegatedRoutingV1HttpApiClientInit = {}): Routing { | ||
return new DelegatedHTTPRouter(new URL(url), init) | ||
} |
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.
we probably also need to update the createHelia
functions to support passing these through right?
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.
For the normal helia
, i .e. HeliaP2P, we don't even instantitate the delegatedHTTPRouter, so not relevant:
helia/packages/helia/src/index.ts
Lines 115 to 130 in e5c03bd
const helia = new HeliaP2P({ | |
...init, | |
libp2p, | |
datastore, | |
blockstore, | |
blockBrokers: init.blockBrokers ?? [ | |
trustlessGateway(), | |
bitswap() | |
], | |
routers: init.routers ?? [ | |
libp2pRouting(libp2p), | |
httpGatewayRouting() | |
], | |
metrics: libp2p.metrics | |
}) | |
For @helia/http
, we do use the delegatedHTTPRouter
: https://github.com/ipfs/helia/blob/f904041bdd2643fabd204485825d4761fc44a83f/packages/http/src/index.ts/#L79-L82
But if you want to cutsomise the delegatedHTTPRouter options, you can just instantiate it yourself and pass it in via init.router
(a bit like how we do it in the example)
We need to get the CI passing here so we can unblock changes in ipfs/service-worker-gateway#391 |
Description
Allow passing delegated routing client options, e.g. IPIP-484 filters, to the delegated HTTP router.
Notes & open questions
Change checklist