Skip to content

Conversation

@aschmahmann
Copy link
Contributor

@aschmahmann aschmahmann commented May 7, 2025

fixes #109

  • cc @lidel took an initial stab, feel free to change whatever you want here.
  • ability to disable DHT and only run this to expose /routing/v1/providers/{cid} for preexisting gateway
  • 5s timeout as precaution (in case someone points this at recursive one, or under load)
  • add tests for HTTP 200 and 404
  • update docs/environment-variables.md

Demo

Start someguy as /routing/v1 proxy for gateway at dag.w3s.link:

$ SOMEGUY_HTTP_BLOCK_PROVIDER_ENDPOINTS="https://dag.w3s.link" SOMEGUY_HTTP_BLOCK_PROVIDER_PEERIDS="QmaSDHYKwuUKTvnsGwqutEZWg5jrpzLJhDHaYRQ9VvrDyZ" SOMEGUY_DHT=disabled SOMEGUY_PROVIDER_ENDPOINTS="" ./someguy start

CID that is at dag.w3s.link:

$ curl http://127.0.0.1:8190/routing/v1/providers/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi -H "Accept: application/x-ndjson"
{"Addrs":["/dns/dag.w3s.link/tcp/443/tls/http"],"ID":"QmaSDHYKwuUKTvnsGwqutEZWg5jrpzLJhDHaYRQ9VvrDyZ","Protocols":["transport-ipfs-gateway-http"],"Schema":"peer"}

If CID is not at gateway, there will be no providers returned.

Important

Set explicit SOMEGUY_PROVIDER_ENDPOINTS="" to disable implicit default of querying cid.contact, and SOMEGUY_DHT=disabled to also disable DHT backend, and only query defined SOMEGUY_HTTP_BLOCK_PROVIDER_ENDPOINTS.

@aschmahmann aschmahmann force-pushed the feat/blocks-routing-backend branch from 59bb83a to a7f4096 Compare May 7, 2025 11:28
@aschmahmann aschmahmann force-pushed the feat/blocks-routing-backend branch from a7f4096 to bf995c9 Compare May 7, 2025 11:35
aschmahmann and others added 3 commits May 7, 2025 09:35
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
@aschmahmann aschmahmann force-pushed the feat/blocks-routing-backend branch from e321a2a to e820148 Compare May 7, 2025 17:45
@aschmahmann aschmahmann force-pushed the feat/blocks-routing-backend branch from e820148 to 992a0c2 Compare May 7, 2025 18:02
lidel added 3 commits May 7, 2025 22:44
- finish sooner rather than waiting 30s (DefaultRoutingTimeout)
- dont return unactionable errors to end user, everything other than
  HTTP 200 should produce empty /routing/v1/providers result set
@lidel lidel force-pushed the feat/blocks-routing-backend branch from 9cf4b6e to 5fb5c32 Compare May 8, 2025 00:22
@lidel lidel marked this pull request as ready for review May 8, 2025 00:25
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aschmahmann pushed tests, docs, and small fixes (hard 5s timeout).
I also updated description of this PR with example how to use it.

This should be good enough to merge & release and ask for feedback – lmk if I should make a release with this.

@aschmahmann
Copy link
Contributor Author

Yep @lidel, LGTM. Merge + release whenever you're ready.

@lidel lidel merged commit fa38a0a into main May 8, 2025
8 checks passed
@lidel lidel deleted the feat/blocks-routing-backend branch May 8, 2025 01:16
@lidel lidel mentioned this pull request May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SOMEGUY_HTTP_BLOCK_PROVIDER_ENDPOINTS as routing proxy for trustless gateways

3 participants