From 16d189b8b86382ebdf93026deef2a9035fd1b140 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Mon, 12 Dec 2022 06:30:18 +0100 Subject: [PATCH 1/3] feat: turn on WebTransport by default Fixes #9292 --- config/init.go | 4 ++++ core/node/libp2p/transport.go | 2 +- docs/changelogs/v0.18.md | 35 ++++++++++++++++++++++++++++++ docs/config.md | 41 ++++++++++------------------------- 4 files changed, 52 insertions(+), 30 deletions(-) diff --git a/config/init.go b/config/init.go index 8f8a97b54ce..e91b248718c 100644 --- a/config/init.go +++ b/config/init.go @@ -116,7 +116,11 @@ func addressesConfig() Addresses { "/ip4/0.0.0.0/tcp/4001", "/ip6/::/tcp/4001", "/ip4/0.0.0.0/udp/4001/quic", + "/ip4/0.0.0.0/udp/4001/quic-v1", + "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport", "/ip6/::/udp/4001/quic", + "/ip6/::/udp/4001/quic-v1", + "/ip6/::/udp/4001/quic-v1/webtransport", }, Announce: []string{}, AppendAnnounce: []string{}, diff --git a/core/node/libp2p/transport.go b/core/node/libp2p/transport.go index 1d039802fc3..f1cc7d8cce4 100644 --- a/core/node/libp2p/transport.go +++ b/core/node/libp2p/transport.go @@ -41,7 +41,7 @@ func Transports(tptConfig config.Transports) interface{} { } // TODO(9292): Remove the false && to allows it enabled by default - if tptConfig.Network.WebTransport.WithDefault(false && !privateNetworkEnabled) { + if tptConfig.Network.WebTransport.WithDefault(!privateNetworkEnabled) { if privateNetworkEnabled { return opts, fmt.Errorf( "WebTransport transport does not support private networks, please disable Swarm.Transports.Network.WebTransport", diff --git a/docs/changelogs/v0.18.md b/docs/changelogs/v0.18.md index 2bd6dc192f5..e518fee1480 100644 --- a/docs/changelogs/v0.18.md +++ b/docs/changelogs/v0.18.md @@ -12,6 +12,8 @@ Below is an outline of all that is in this release, so you get a sense of all th - [🔦 Highlights](#-highlights) - [(DAG-)JSON and (DAG-)CBOR Response Formats on Gateways](#dag-json-and-dag-cbor-response-formats-on-gateways) - [Content Routing](#content-routing) + - [WebTransport enabled by default](#webtransport-enabled-by-default) + - [QUICv1 & WebTransport Config Migration](#quicv1--webtransport-config-migration) - [Provider Record Republish and Expiration](#provider-record-republish-and-expiration) - [Lowered `ConnMgr`](#lowered-connmgr) - [Changelog](#changelog) @@ -89,6 +91,39 @@ Alternative routing rules, including alternative IPNI endpoints, can be configur Learn more in [`Routing` docs](https://github.com/ipfs/kubo/blob/master/docs/config.md#routing). +#### WebTransport enabled by default + +[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. + +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. +For the full story see [connectivity.libp2p.io](https://connectivity.libp2p.io/). + +##### WebTransport + QUIC on one single port + +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). + +To use this feature, you just have to register two listen address on the same `/ipX/.../udp/XXX` prefix. + +#### QUICv1 & WebTransport Config Migration + +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`. +This manifest as two different multiaddr components `/quic` (old Draft-29) and `/quic-v1`. + +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. + +`/webtransport` now also need to be prefixed by a `/quic-v1` instead of `/quic` component. +This has no protocol change, WebTransport only supports QUICv1 and were running on QUICv1 already. + +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: +- Replace all `/quic/webtransport` to `/quic-v1/webtransport`. +- For all `/quic` listener, keep the Draft-29 listener, and on the same ip and port, add `/quic-v1` and `/quic-v1/webtransport` listeners. + +##### `/quic` (Draft-29) early-deprecation + +We plan to remove support for QUIC Draft-29 in the mid to long term future. + +You must not use `/quic` for new deployements and use `/quic-v1` instead. + #### Provider Record Republish and Expiration 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). diff --git a/docs/config.md b/docs/config.md index 0c42296bf16..b23a3b14e7d 100644 --- a/docs/config.md +++ b/docs/config.md @@ -369,8 +369,9 @@ Supported Transports: * tcp/ip{4,6} - `/ipN/.../tcp/...` * websocket - `/ipN/.../tcp/.../ws` -* quic - `/ipN/.../udp/.../quic` -* webtransport (*experiemental*) - `/ipN/.../udp/.../quic/webtransport` - require using a different port than the QUIC listener for now +* quic (Draft-29) - `/ipN/.../udp/.../quic` - can share the same two tuple with `/quic-v1` and `/quic-v1/webtransport` +* quicv1 (RFC9000) - `/ipN/.../udp/.../quic-v1` - can share the same two tuple with `/quic` and `/quic-v1/webtransport` +* webtransport `/ipN/.../udp/.../quic-v1/webtransport` - can share the same two tuple with `/quic` and `/quic-v1` Default: ```json @@ -378,7 +379,11 @@ Default: "/ip4/0.0.0.0/tcp/4001", "/ip6/::/tcp/4001", "/ip4/0.0.0.0/udp/4001/quic", - "/ip6/::/udp/4001/quic" + "/ip4/0.0.0.0/udp/4001/quic-v1", + "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport", + "/ip6/::/udp/4001/quic", + "/ip6/::/udp/4001/quic-v1", + "/ip6/::/udp/4001/quic-v1/webtransport" ] ``` @@ -1209,7 +1214,7 @@ forgotten about. A smaller value for this parameter means that Pubsub messages in the cache will be garbage collected sooner, which can result in a smaller cache. At the same time, if there are slower nodes in the network that forward older messages, -this can cause more duplicates to be propagated through the network. +this can cause more duplicates to be propagated through the network. Conversely, a larger value for this parameter means that Pubsub messages in the cache will be garbage collected later, which can result in a larger cache for @@ -1812,7 +1817,7 @@ Type: `flag` This is the max amount of memory to allow libp2p to use. libp2p's resource manager will prevent additional resource creation while this limit is reached. -This value is also used to scale the limit on various resources at various scopes +This value is also used to scale the limit on various resources at various scopes when the default limits (discussed in [libp2p resource management](./libp2p-resource-management.md)) are used. For example, increasing this value will increase the default limit for incoming connections. @@ -1837,7 +1842,7 @@ The map supports fields from the [`LimitConfig` struct](https://github.com/libp2 [`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 s are optional. -The `Swarm.ResourceMgr.Limits` override the default limits described above. +The `Swarm.ResourceMgr.Limits` override the default limits described above. Any override `BaseLimits` or limit s from `Swarm.ResourceMgr.Limits` that aren't specified will use the [computed default limits](./libp2p-resource-management.md#computed-default-limits). @@ -1992,38 +1997,16 @@ Since this runs on top of `HTTP/3` it uses `QUIC` under the hood. We expect it to perform worst than `QUIC` because of the extra overhead, this transport is really meant at agents that cannot do `TCP` or `QUIC` (like browsers). -For now it is **disabled by default** and considered **experimental**. -If you find issues running it please [report them to us](https://github.com/ipfs/kubo/issues/new). - -In the future Kubo will listen on WebTransport by default for anyone already listening on QUIC addresses. - WebTransport is a new transport protocol currently under development by the IETF and the W3C, and already implemented by Chrome. 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, thereby enabling any js-libp2p node running in a browser to connect to any kubo node, with zero manual configuration involved. The previous alternative is websocket secure, which require installing a reverse proxy and TLS certificates manually. -Default: Disabled +Default: Enabled Type: `flag` - -##### How to enable WebTransport - -Thoses steps are temporary and wont be needed once we make it enabled by default. - -1. Enable the WebTransport transport: - `ipfs config Swarm.Transports.Network.WebTransport --json true` -1. Add a listener address for WebTransport to your `Addresses.Swarm` key, for example: - ```json - [ - "/ip4/0.0.0.0/tcp/4001", - "/ip4/0.0.0.0/udp/4001/quic", - "/ip4/0.0.0.0/udp/4002/quic/webtransport" - ] - ``` -1. Restart your daemon to apply the config changes. - ### `Swarm.Transports.Security` Configuration section for libp2p _security_ transports. Transports enabled in From 710d3208af91e0a9502f61f40ce88a43857f42a5 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Mon, 12 Dec 2022 21:50:37 +0100 Subject: [PATCH 2/3] feat: update upgrade repo from 12 to 13 Fixes: #9292 --- repo/fsrepo/fsrepo.go | 2 +- repo/fsrepo/migrations/fetcher.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/repo/fsrepo/fsrepo.go b/repo/fsrepo/fsrepo.go index 219f136f71e..99104b08318 100644 --- a/repo/fsrepo/fsrepo.go +++ b/repo/fsrepo/fsrepo.go @@ -36,7 +36,7 @@ const LockFile = "repo.lock" var log = logging.Logger("fsrepo") // RepoVersion is the version number that we are currently expecting to see -var RepoVersion = 12 +var RepoVersion = 13 var migrationInstructions = `See https://github.com/ipfs/fs-repo-migrations/blob/master/run.md Sorry for the inconvenience. In the future, these will run automatically.` diff --git a/repo/fsrepo/migrations/fetcher.go b/repo/fsrepo/migrations/fetcher.go index 87fa95b8b22..c174b5e7775 100644 --- a/repo/fsrepo/migrations/fetcher.go +++ b/repo/fsrepo/migrations/fetcher.go @@ -11,7 +11,7 @@ import ( const ( // Current distribution to fetch migrations from - CurrentIpfsDist = "/ipfs/QmdaCHYBDHEhXCMoynH5UcohEay6m1XayZCcxWZzKAHNVN" // fs-repo-11-to-12 v1.0.2 + CurrentIpfsDist = "/ipfs/Qmf4yftD4LuMo8JMNPqqw3BtUwYd2VkXMiAThuPE6usrbQ" // fs-repo-12-to-13 v1.0.0 // Latest distribution path. Default for fetchers. LatestIpfsDist = "/ipns/dist.ipfs.tech" From e927dc8e594d2688a2dc64f6165b70ecc94ff03e Mon Sep 17 00:00:00 2001 From: Jorropo Date: Mon, 12 Dec 2022 22:26:48 +0100 Subject: [PATCH 3/3] fix: correct libp2p transports TODO comments --- core/node/libp2p/transport.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/node/libp2p/transport.go b/core/node/libp2p/transport.go index f1cc7d8cce4..f737c608643 100644 --- a/core/node/libp2p/transport.go +++ b/core/node/libp2p/transport.go @@ -36,11 +36,9 @@ func Transports(tptConfig config.Transports) interface{} { "QUIC transport does not support private networks, please disable Swarm.Transports.Network.QUIC", ) } - // TODO(9290): Make WithMetrics configurable opts.Opts = append(opts.Opts, libp2p.Transport(quic.NewTransport)) } - // TODO(9292): Remove the false && to allows it enabled by default if tptConfig.Network.WebTransport.WithDefault(!privateNetworkEnabled) { if privateNetworkEnabled { return opts, fmt.Errorf(