diff --git a/core/node/libp2p/smux.go b/core/node/libp2p/smux.go index 0966dfaf2564..279407191260 100644 --- a/core/node/libp2p/smux.go +++ b/core/node/libp2p/smux.go @@ -3,7 +3,6 @@ package libp2p import ( "fmt" "os" - "strings" "github.com/ipfs/kubo/config" @@ -14,40 +13,16 @@ import ( func makeSmuxTransportOption(tptConfig config.Transports) (libp2p.Option, error) { if prefs := os.Getenv("LIBP2P_MUX_PREFS"); prefs != "" { - // Using legacy LIBP2P_MUX_PREFS variable. - log.Error("LIBP2P_MUX_PREFS is now deprecated.") - log.Error("Use the `Swarm.Transports.Multiplexers' config field.") - muxers := strings.Fields(prefs) - enabled := make(map[string]bool, len(muxers)) - - var opts []libp2p.Option - for _, tpt := range muxers { - if enabled[tpt] { - return nil, fmt.Errorf( - "duplicate muxer found in LIBP2P_MUX_PREFS: %s", - tpt, - ) - } - switch tpt { - case yamux.ID: - opts = append(opts, libp2p.Muxer(tpt, yamux.DefaultTransport)) - case mplex.ID: - opts = append(opts, libp2p.Muxer(tpt, mplex.DefaultTransport)) - default: - return nil, fmt.Errorf("unknown muxer: %s", tpt) - } - } - return libp2p.ChainOptions(opts...), nil + return nil, fmt.Errorf("configuring muxers with LIBP2P_MUX_PREFS is no longer supported, use Swarm.Transports.Multiplexers") + } + if tptConfig.Multiplexers.Mplex != 0 { + return nil, fmt.Errorf("Swarm.Transports.Multiplexers.Mplex is no longer supported, remove it from your config, see https://github.com/libp2p/specs/issues/553") } - return prioritizeOptions([]priorityOption{{ - priority: tptConfig.Multiplexers.Yamux, - defaultPriority: 100, - opt: libp2p.Muxer(yamux.ID, yamux.DefaultTransport), - }, { - priority: tptConfig.Multiplexers.Mplex, - defaultPriority: config.Disabled, - opt: libp2p.Muxer(mplex.ID, mplex.DefaultTransport), - }}), nil + if tptConfig.Multiplexers.Yamux < 0 { + return nil, fmt.Errorf("running libp2p with Swarm.Transports.Multiplexers.Yamux disabled is not supported") + } + + return libp2p.Muxer(yamux.ID, yamux.DefaultTransport), nil } func SmuxTransport(tptConfig config.Transports) func() (opts Libp2pOpts, err error) { diff --git a/docs/changelogs/v0.25.md b/docs/changelogs/v0.25.md index 98e2a04f9d4b..b4945758a1c7 100644 --- a/docs/changelogs/v0.25.md +++ b/docs/changelogs/v0.25.md @@ -7,6 +7,7 @@ - [Overview](#overview) - [๐Ÿ”ฆ Highlights](#-highlights) - [RPC `API.Authorizations`](#rpc-apiauthorizations) + - [MPLEX removal](#mplex-removal) - [Graphsync Experiment Removal](#graphsync-experiment-removal) - [๐Ÿ“ Changelog](#-changelog) - [๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributors](#-contributors) @@ -28,6 +29,16 @@ This feature is opt-in. By default, no authorization is set up. For configuration instructions, refer to the [documentation](https://github.com/ipfs/kubo/blob/master/docs/config.md#apiauthorizations). +#### MPLEX Removal + +After deprecating and removing mplex support by default in [v0.23.0](https://github.com/ipfs/kubo/blob/master/docs/changelogs/v0.23.md#mplex-deprecation). + +We now fully removed it. If you still need mplex support to talk with other pieces of software, +please try updating them, and if they don't support yamux or QUIC talk to us about it. + +Mplex is unreliable by design, it will drop data and generete errors when sending data *too fast*, +yamux and QUIC support backpressure, that means if we send data faster than the remote machine can process it, we slows down to match the remote's speed. + #### Graphsync Experiment Removal Currently the Graphsync server is to our knowledge not used diff --git a/docs/config.md b/docs/config.md index 0b33fa3fdcf8..df35d2ce87ee 100644 --- a/docs/config.md +++ b/docs/config.md @@ -2253,21 +2253,10 @@ Type: `priority` ### `Swarm.Transports.Multiplexers.Mplex` -**DEPRECATED**: See https://github.com/ipfs/kubo/issues/9958 +**REMOVED**: See https://github.com/ipfs/kubo/issues/9958 -Mplex is deprecated, this is because it is unreliable and -randomly drop streams when sending data *too fast*. - -New pieces of code rely on backpressure, that means the stream will dynamically -slow down the sending rate if data is getting backed up. -Backpressure is provided by **Yamux** and **QUIC**. - -If you want to turn it back on make sure to have a higher (lower is better) -priority than `Yamux`, you don't want your Kubo to start defaulting to Mplex. - -Default: `200` - -Type: `priority` +Support for Mplex has been [removed from Kubo and go-libp2p](https://github.com/libp2p/specs/issues/553). +Please remove this option from your config. ## `DNS` diff --git a/test/cli/transports_test.go b/test/cli/transports_test.go index c1642c602cdd..a523351816da 100644 --- a/test/cli/transports_test.go +++ b/test/cli/transports_test.go @@ -72,20 +72,6 @@ func TestTransports(t *testing.T) { runTests(nodes) }) - t.Run("tcp with mplex", func(t *testing.T) { - // FIXME(#10069): we don't want this to exists anymore - t.Parallel() - nodes := tcpNodes(t) - nodes.ForEachPar(func(n *harness.Node) { - n.UpdateConfig(func(cfg *config.Config) { - cfg.Swarm.Transports.Multiplexers.Yamux = config.Disabled - cfg.Swarm.Transports.Multiplexers.Mplex = 200 - }) - }) - nodes.StartDaemons().Connect() - runTests(nodes) - }) - t.Run("tcp with NOISE", func(t *testing.T) { t.Parallel() nodes := tcpNodes(t)