Open lidel opened 1 year ago
@MarcoPolo what would be the absolute minimum amount of libp2p we would have to implement here to:
/..../webtransport/../p2p/{peerid}
multiaddr/http*
and probe for /ipfs
endpoint./webtransport connection that exposes
/ipfs` endpoints semantics
?At a very high level:
- take /..../webtransport/../p2p/{peerid} multiaddr
a. Parse the multiaddr. b. Parse multihash (certhashes). c. Parse the peer id.
- connect to it
Right now this requires peer authentication. There's interest to make WebTransport authentication optional in the future, which would simplify this use case.
a. Open a WebTransport connection to https://example.com/.well-known/libp2p-webtransport?type=noise
b. Due to peer auth, run a libp2p noise handshake: https://github.com/libp2p/specs/tree/master/noise#the-noise-handshake
c. If doing peer auth, verify the certhashes of the peer are what you expect.
- check if it supports /http* and probe for /ipfs endpoint.
a. Open a new stream and negotiate /http/1.1
on it. If this worked they support HTTP over libp2p.
b. GET the .well-known/libp2p
resource and see where the trustless-gateway is mounted.
- Get blocks!
a. Open a new stream with /http/1.1
for each HTTP request.
b. Use js-libp2p-fetch instead of fetch
to get the blocks. (js-libp2p-fetch doesn't actually need js-libp2p, and is almost 0 dependencies except for a js-libp2p quirk requiring a Uint8ArrayList dependency).
c. At this point it should be identical to the existing way.
If we prioritize this we could make webtransport auth optional, and thus reduce a lot of complexity around doing the Noise handshake.
Update: Kubo 0.23 will include opt-in "gateway over libp2p" experiment from https://github.com/ipfs/kubo/pull/10108
TLDR
/webtransport
(or /https
or /http/tls
-- these are plain HTTP gateways) /certhash
is included in the multiaddr (e.g. /ip4/{ip}/udp/{port}/quic-v1/webtransport/certhash/{chash}
I think it is long term thing, but we should be able to make it work:
/routing/v1
most likely will be enabled by default on gateways in the future, allowing for lookup for additional gateways/providers
/https
and /http/tls
could work today – I've filled separate https://github.com/little-bear-labs/ipfs-chromium/issues/66 with details /webtransport
will require more effort, implementing a bare minimum of libp2p necessary for establishing connection to get /http/1.1
socket.
This is a placeholder for work that will improve connectivity by leveraging peers that expose HTTP Gateway over WebTransport with certhash.
Not ready yet, but will update this issue as relevant building blocks land in ecosystem.
High level idea
/routing/v1
endpoint (https://specs.ipfs.tech/routing/http-routing-v1/, https://github.com/protocol/bifrost-infra/issues/2142) to learn about addresses of peers that speak/webtransport
Open questions
/webtransport
connection it will grow the pie of possible sources of blocks/ipfs/{cid}
block/car in Kubo