feat: turn on WebTransport by default
Fixes #9292
Jorropo committed
Dec 12, 2022 at 06:30 UTC
16d189b8b86382ebdf93026deef2a9035fd1b140
4 files changed
+52
-30
config/init.go
+4
@@ -116,7 +116,11 @@ func addressesConfig() Addresses {
116
"/ip4/0.0.0.0/tcp/4001",
117
"/ip6/::/tcp/4001",
118
"/ip4/0.0.0.0/udp/4001/quic",
119
+ "/ip4/0.0.0.0/udp/4001/quic-v1",
120
+ "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport",
121
"/ip6/::/udp/4001/quic",
122
+ "/ip6/::/udp/4001/quic-v1",
123
+ "/ip6/::/udp/4001/quic-v1/webtransport",
124
},
125
Announce: []string{},
126
AppendAnnounce: []string{},
core/node/libp2p/transport.go
+1
-1
@@ -41,7 +41,7 @@ func Transports(tptConfig config.Transports) interface{} {
41
}
42
43
// TODO(9292): Remove the false && to allows it enabled by default
44
- if tptConfig.Network.WebTransport.WithDefault(false && !privateNetworkEnabled) {
44
+ if tptConfig.Network.WebTransport.WithDefault(!privateNetworkEnabled) {
45
if privateNetworkEnabled {
46
return opts, fmt.Errorf(
47
"WebTransport transport does not support private networks, please disable Swarm.Transports.Network.WebTransport",
docs/changelogs/v0.18.md
+35
@@ -12,6 +12,8 @@ Below is an outline of all that is in this release, so you get a sense of all th
12
- [🔦 Highlights](#-highlights)
13
- [(DAG-)JSON and (DAG-)CBOR Response Formats on Gateways](#dag-json-and-dag-cbor-response-formats-on-gateways)
14
- [Content Routing](#content-routing)
15
+ - [WebTransport enabled by default](#webtransport-enabled-by-default)
16
+ - [QUICv1 & WebTransport Config Migration](#quicv1--webtransport-config-migration)
17
- [Provider Record Republish and Expiration](#provider-record-republish-and-expiration)
18
- [Lowered `ConnMgr`](#lowered-connmgr)
19
- [Changelog](#changelog)
@@ -89,6 +91,39 @@ Alternative routing rules, including alternative IPNI endpoints, can be configur
91
92
Learn more in [`Routing` docs](https://github.com/ipfs/kubo/blob/master/docs/config.md#routing).
93
94
+#### WebTransport enabled by default
95
+
96
+[WebTransport](https://github.com/libp2p/go-libp2p/issues/1717) is a new libp2p transport that [has been introduced in v0.16](v0.16.md#-webtransport-new-experimental-transport) that is based on top of QUIC and HTTP3.
97
+
98
+This allows browsers to contact Kubo nodes, so now instead of just serving requests for other system level applicative nodes, you can also serve requests directly to a browser.
99
+For the full story see [connectivity.libp2p.io](https://connectivity.libp2p.io/).
100
+
101
+##### WebTransport + QUIC on one single port
102
+
103
+The new feature that allows us to ship WebTransport by default is that [go-libp2p now supports running WebTransport and QUIC transports on the same QUIC listener](https://github.com/libp2p/go-libp2p/issues/1759).
104
+
105
+To use this feature, you just have to register two listen address on the same `/ipX/.../udp/XXX` prefix.
106
+
107
+#### QUICv1 & WebTransport Config Migration
108
+
109
+Go-libp2p now differentiate the first version of QUIC we implemented (and were using until then), `Draft-29`, and the ratified protocol in RFC9000, `QUICv1`.
110
+This manifest as two different multiaddr components `/quic` (old Draft-29) and `/quic-v1`.
111
+
112
+Even tho Draft-29 and QUICv1 are similar they are not fully inter-compatible, go-libp2p do supports listening with both versions on one single listener.
113
+
114
+`/webtransport` now also need to be prefixed by a `/quic-v1` instead of `/quic` component.
115
+This has no protocol change, WebTransport only supports QUICv1 and were running on QUICv1 already.
116
+
117
+To support QUICv1 and WebTransport by default we run a new migration (n°`13`) which automatically add entries in addresses related fields in the config:
118
+- Replace all `/quic/webtransport` to `/quic-v1/webtransport`.
119
+- For all `/quic` listener, keep the Draft-29 listener, and on the same ip and port, add `/quic-v1` and `/quic-v1/webtransport` listeners.
120
+
121
+##### `/quic` (Draft-29) early-deprecation
122
+
123
+We plan to remove support for QUIC Draft-29 in the mid to long term future.
124
+
125
+You must not use `/quic` for new deployements and use `/quic-v1` instead.
126
+
127
#### Provider Record Republish and Expiration
128
129
Default `Reprovider.Interval` changed from 12h to 22h to match new defaults for the Provider Record Expiration (48h) in [go-libp2p-kad-dht v0.20.0](https://github.com/libp2p/go-libp2p-kad-dht/releases/tag/v0.20.0).
docs/config.md
+12
-29
@@ -369,8 +369,9 @@ Supported Transports:
369
370
* tcp/ip{4,6} - `/ipN/.../tcp/...`
371
* websocket - `/ipN/.../tcp/.../ws`
372
-* quic - `/ipN/.../udp/.../quic`
373
-* webtransport (*experiemental*) - `/ipN/.../udp/.../quic/webtransport` - require using a different port than the QUIC listener for now
372
+* quic (Draft-29) - `/ipN/.../udp/.../quic` - can share the same two tuple with `/quic-v1` and `/quic-v1/webtransport`
373
+* quicv1 (RFC9000) - `/ipN/.../udp/.../quic-v1` - can share the same two tuple with `/quic` and `/quic-v1/webtransport`
374
+* webtransport `/ipN/.../udp/.../quic-v1/webtransport` - can share the same two tuple with `/quic` and `/quic-v1`
375
376
Default:
377
```json
@@ -378,7 +379,11 @@ Default:
379
"/ip4/0.0.0.0/tcp/4001",
380
"/ip6/::/tcp/4001",
381
"/ip4/0.0.0.0/udp/4001/quic",
381
- "/ip6/::/udp/4001/quic"
382
+ "/ip4/0.0.0.0/udp/4001/quic-v1",
383
+ "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport",
384
+ "/ip6/::/udp/4001/quic",
385
+ "/ip6/::/udp/4001/quic-v1",
386
+ "/ip6/::/udp/4001/quic-v1/webtransport"
387
]
388
```
389
@@ -1209,7 +1214,7 @@ forgotten about.
1214
A smaller value for this parameter means that Pubsub messages in the cache will
1215
be garbage collected sooner, which can result in a smaller cache. At the same
1216
time, if there are slower nodes in the network that forward older messages,
1212
-this can cause more duplicates to be propagated through the network.
1217
+this can cause more duplicates to be propagated through the network.
1218
1219
Conversely, a larger value for this parameter means that Pubsub messages in the
1220
cache will be garbage collected later, which can result in a larger cache for
@@ -1812,7 +1817,7 @@ Type: `flag`
1817
1818
This is the max amount of memory to allow libp2p to use.
1819
libp2p's resource manager will prevent additional resource creation while this limit is reached.
1815
-This value is also used to scale the limit on various resources at various scopes
1820
+This value is also used to scale the limit on various resources at various scopes
1821
when the default limits (discussed in [libp2p resource management](./libp2p-resource-management.md)) are used.
1822
For example, increasing this value will increase the default limit for incoming connections.
1823
@@ -1837,7 +1842,7 @@ The map supports fields from the [`LimitConfig` struct](https://github.com/libp2
1842
1843
[`BaseLimit`s](https://github.com/libp2p/go-libp2p/blob/master/p2p/host/resource-manager/limit.go#L89) can be set for any scope, and within the `BaseLimit`, all limit <key,value>s are optional.
1844
1840
-The `Swarm.ResourceMgr.Limits` override the default limits described above.
1845
+The `Swarm.ResourceMgr.Limits` override the default limits described above.
1846
Any override `BaseLimits` or limit <key,value>s from `Swarm.ResourceMgr.Limits`
1847
that aren't specified will use the [computed default limits](./libp2p-resource-management.md#computed-default-limits).
1848
@@ -1992,38 +1997,16 @@ Since this runs on top of `HTTP/3` it uses `QUIC` under the hood.
1997
We expect it to perform worst than `QUIC` because of the extra overhead,
1998
this transport is really meant at agents that cannot do `TCP` or `QUIC` (like browsers).
1999
1995
-For now it is **disabled by default** and considered **experimental**.
1996
-If you find issues running it please [report them to us](https://github.com/ipfs/kubo/issues/new).
1997
-
1998
-In the future Kubo will listen on WebTransport by default for anyone already listening on QUIC addresses.
1999
-
2000
WebTransport is a new transport protocol currently under development by the IETF and the W3C, and already implemented by Chrome.
2001
Conceptually, it’s like WebSocket run over QUIC instead of TCP. Most importantly, it allows browsers to establish (secure!) connections to WebTransport servers without the need for CA-signed certificates,
2002
thereby enabling any js-libp2p node running in a browser to connect to any kubo node, with zero manual configuration involved.
2003
2004
The previous alternative is websocket secure, which require installing a reverse proxy and TLS certificates manually.
2005
2006
-Default: Disabled
2006
+Default: Enabled
2007
2008
Type: `flag`
2009
2010
-
2011
-##### How to enable WebTransport
2012
-
2013
-Thoses steps are temporary and wont be needed once we make it enabled by default.
2014
-
2015
-1. Enable the WebTransport transport:
2016
- `ipfs config Swarm.Transports.Network.WebTransport --json true`
2017
-1. Add a listener address for WebTransport to your `Addresses.Swarm` key, for example:
2018
- ```json
2019
- [
2020
- "/ip4/0.0.0.0/tcp/4001",
2021
- "/ip4/0.0.0.0/udp/4001/quic",
2022
- "/ip4/0.0.0.0/udp/4002/quic/webtransport"
2023
- ]
2024
- ```
2025
-1. Restart your daemon to apply the config changes.
2026
-
2010
### `Swarm.Transports.Security`
2011
2012
Configuration section for libp2p _security_ transports. Transports enabled in