Skip to content

Commit

Permalink
muxer: remove support for mplex
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Aug 17, 2023
1 parent e935729 commit 6cc3fc6
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 207 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ require (
github.com/libp2p/go-flow-metrics v0.1.0
github.com/libp2p/go-libp2p-asn-util v0.3.0
github.com/libp2p/go-libp2p-testing v0.12.0
github.com/libp2p/go-mplex v0.7.0
github.com/libp2p/go-msgio v0.3.0
github.com/libp2p/go-nat v0.2.0
github.com/libp2p/go-netroute v0.2.1
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,6 @@ github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLE
github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w=
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg=
github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY=
github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU=
github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0=
github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM=
github.com/libp2p/go-nat v0.2.0 h1:Tyz+bUFAYqGyJ/ppPPymMGbIgNRH+WqC5QrT5fKrrGk=
Expand Down
48 changes: 0 additions & 48 deletions p2p/muxer/mplex/conn.go

This file was deleted.

64 changes: 0 additions & 64 deletions p2p/muxer/mplex/stream.go

This file was deleted.

28 changes: 0 additions & 28 deletions p2p/muxer/mplex/transport.go

This file was deleted.

52 changes: 0 additions & 52 deletions p2p/muxer/mplex/transport_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion p2p/net/swarm/swarm_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestMetricsNoAllocNoCover(t *testing.T) {
{StreamMultiplexer: "yamux", Security: "tls", Transport: "tcp", UsedEarlyMuxerNegotiation: true},
{StreamMultiplexer: "yamux", Security: "noise", Transport: "tcp", UsedEarlyMuxerNegotiation: false},
{StreamMultiplexer: "", Security: "", Transport: "quic"},
{StreamMultiplexer: "mplex", Security: "noise", Transport: "tcp"},
{StreamMultiplexer: "another-yamux", Security: "noise", Transport: "tcp"},
}

directions := []network.Direction{network.DirInbound, network.DirOutbound}
Expand Down
21 changes: 10 additions & 11 deletions p2p/test/negotiation/muxer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/libp2p/go-libp2p/core/sec/insecure"
"github.com/libp2p/go-libp2p/p2p/muxer/mplex"
"github.com/libp2p/go-libp2p/p2p/muxer/yamux"
"github.com/libp2p/go-libp2p/p2p/security/noise"
tls "github.com/libp2p/go-libp2p/p2p/security/tls"
Expand All @@ -21,8 +20,8 @@ import (
)

var (
yamuxOpt = libp2p.Muxer("/yamux", yamux.DefaultTransport)
mplexOpt = libp2p.Muxer("/mplex", mplex.DefaultTransport)
yamuxOpt = libp2p.Muxer("/yamux", yamux.DefaultTransport)
anotherYamuxOpt = libp2p.Muxer("/another-yamux", yamux.DefaultTransport)
)

type testcase struct {
Expand All @@ -43,32 +42,32 @@ func TestMuxerNegotiation(t *testing.T) {
testcases := []testcase{
{
Name: "server and client have the same preference",
ServerPreference: []libp2p.Option{yamuxOpt, mplexOpt},
ClientPreference: []libp2p.Option{yamuxOpt, mplexOpt},
ServerPreference: []libp2p.Option{yamuxOpt, anotherYamuxOpt},
ClientPreference: []libp2p.Option{yamuxOpt, anotherYamuxOpt},
Expected: "/yamux",
},
{
Name: "client only supports one muxer",
ServerPreference: []libp2p.Option{yamuxOpt, mplexOpt},
ServerPreference: []libp2p.Option{yamuxOpt, anotherYamuxOpt},
ClientPreference: []libp2p.Option{yamuxOpt},
Expected: "/yamux",
},
{
Name: "server only supports one muxer",
ServerPreference: []libp2p.Option{yamuxOpt},
ClientPreference: []libp2p.Option{mplexOpt, yamuxOpt},
ClientPreference: []libp2p.Option{anotherYamuxOpt, yamuxOpt},
Expected: "/yamux",
},
{
Name: "client preference preferred",
ServerPreference: []libp2p.Option{yamuxOpt, mplexOpt},
ClientPreference: []libp2p.Option{mplexOpt, yamuxOpt},
Expected: "/mplex",
ServerPreference: []libp2p.Option{yamuxOpt, anotherYamuxOpt},
ClientPreference: []libp2p.Option{anotherYamuxOpt, yamuxOpt},
Expected: "/another-yamux",
},
{
Name: "no preference overlap",
ServerPreference: []libp2p.Option{yamuxOpt},
ClientPreference: []libp2p.Option{mplexOpt},
ClientPreference: []libp2p.Option{anotherYamuxOpt},
Error: "failed to negotiate stream multiplexer: protocols not supported",
},
}
Expand Down

0 comments on commit 6cc3fc6

Please sign in to comment.