libp2p/specs

docs: WebTransport and CircuitV2

Winterhuman opened this issue · 10 comments

I was reading https://github.com/libp2p/specs/tree/master/webtransport when I saw:

"The WebTransport URL of a WebTransport server advertising /ip4/192.0.2.0/udp/1443/quic/webtransport/ would be https://192.0.2.0:1443/.well-known/libp2p-webtransport?type=noise."

If the URL is what's actually being tried, doesn't that mean you can't use WebTransport only with CircuitV2 to establish a connection from a browser to a node behind NAT? Should this be documented if so?

WebTransport runs on top of HTTP/3, so there's no way around this.

Thanks for confirming. Do you think it's worth noting somewhere in the documentation that HTTP-based transports are incompatible with CircuitV2?

That applies to all non-TCP transports, doesn't it?

QUIC & WebSocket work don't they?

Ah no, WebSocket wouldn't either since that needs a URL too

I see what you mean now, anything that isn't TCP or QUIC is incompatible with CircuitV2, there would be too many transports to list them all; it's an inherit property of web-available transports. Closing issue

EDIT: Or not? See discussion after

A relayed connection is a single, bidirectional byte stream, so all you can is upgrade that byte stream with a security and muxer protocol, analogous to what you do with a TCP connection.

For the connection to the relay, you can use any transport you like, including WebRTC and WebTransport.

@marten-seemann I'm confused. Just to ask plainly, if there are two nodes, A and B, who are both behind non-symmetric NATs, and who only use WebTransport, can CircuitV2 allow a direct connection between A and B to form? If not, would A having transports other than WebTransport available, but not B, make this work instead?

This is assuming node B is running in a browser, and is subject to the browser's WebTransport API

Circuitv2 doesn't allow direct connection, it allows relayed connections. It is a prerequisite for hole punching though, which then would give you a direct connection.

This should answer you question:

For the connection to the relay, you can use any transport you like, including WebRTC and WebTransport.

No, I'm still confused, you're saying CircuitV2 can give you a direct connection after the holepunching packets are sent, but you also said "WebTransport runs on top of HTTP/3, so there's no way around this." implying WebTransport can't use the holepunched ports?

I'll leave the discussion here though, it's better if I wait until CircuitV2 support is merged in js-libp2p to actually test this