Skip to content
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

Fetch over libp2p #2204

Closed
p-shahi opened this issue Mar 20, 2023 · 4 comments
Closed

Fetch over libp2p #2204

p-shahi opened this issue Mar 20, 2023 · 4 comments
Assignees

Comments

@p-shahi
Copy link
Member

p-shahi commented Mar 20, 2023

Supporting work for ipfs/in-web-browsers#207 see comment: ipfs/in-web-browsers#207 (comment)

@SgtPooki
Copy link
Member

@p-shahi I think this belongs in js-libp2p, and i'm not sure we need this because fetching is working. I need more context from @aschmahmann and @MarcoPolo to understand exactly what we need from Marco here

@aschmahmann
Copy link
Collaborator

i'm not sure we need this because fetching is working

I think we have a terminology precision issue, so let's see if we can clear it up.

IIUC the desire here is for https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API to work over libp2p connections in browsers so as to enable things like doing HTTP requests to servers that do not have certificates signed by root CAs.

This is related to the HTTP-over-libp2p work linked above which, while not strictly necessary to support service workers retrieving data over libp2p (e.g. I can use a protocol like Bitswap over WebTransport or WSS), is nice to have as it enables libp2p consumers to use the same APIs to talk to both more standard HTTP servers and ones that are only accessible if you have other libp2p capabilities available (e.g. connecting over WebTransport where root CA certs are not required, tunneling over libp2p relays, webrtc connections established via holepunching, ...).


IIUC there are a few broad issues for this to work but this one (Fetch over libp2p) probably lives in js-libp2p.

  1. Define HTTP-over-libp2p spec
  2. Implement in Go
  3. Implement in (browser friendly) JS
  4. Build a wrapper around the js-libp2p http-over-libp2p component such that matches the Fetch API so people can use it for http-over-libp2p as easily as standard HTTP connections.

@MarcoPolo
Copy link
Collaborator

… this one (Fetch over libp2p) probably lives in js-libp2p.

Agreed.

  1. Implement in Go

WIP here: #2218

  1. & 4

Is what I’ll try to start next week. I already did some exploratory work on service workers to learn about them a bit.

This is an example of matching the fetch API but for a new protocol (in this case IPFS rather than libp2p) https://github.com/RangerMauve/js-ipfs-fetch

Cool, thanks for the link, I think that’s helpful for at least part of this.


Closing this, since it doesn’t make sense to be in go-libp2p.

New js-libp2p issue here: libp2p/js-libp2p#1648

@p-shahi
Copy link
Member Author

p-shahi commented Mar 31, 2023

issue moved to libp2p/js-libp2p#1648

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

No branches or pull requests

4 participants