Browse Source

switch from github.com/libp2p/go-libp2p-transport-upgrader to p2p/net/upgrader

pull/1463/head
Marten Seemann 3 years ago
parent
commit
9dc18edc26
  1. 3
      config/config.go
  2. 6
      go.mod
  3. 1
      go.sum
  4. 2
      p2p/net/swarm/dial_worker_test.go
  5. 2
      p2p/net/swarm/testing/testing.go
  6. 2
      p2p/net/upgrader/listener_test.go
  7. 8
      p2p/net/upgrader/upgrader_test.go
  8. 2
      p2p/transport/tcp/tcp.go
  9. 2
      p2p/transport/tcp/tcp_test.go
  10. 2
      p2p/transport/websocket/websocket_test.go

3
config/config.go

@ -24,12 +24,11 @@ import (
blankhost "github.com/libp2p/go-libp2p/p2p/host/blank"
routed "github.com/libp2p/go-libp2p/p2p/host/routed"
"github.com/libp2p/go-libp2p/p2p/net/swarm"
tptu "github.com/libp2p/go-libp2p/p2p/net/upgrader"
circuitv2 "github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client"
relayv2 "github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/relay"
"github.com/libp2p/go-libp2p/p2p/protocol/holepunch"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
logging "github.com/ipfs/go-log/v2"
ma "github.com/multiformats/go-multiaddr"
madns "github.com/multiformats/go-multiaddr-dns"

6
go.mod

@ -13,6 +13,7 @@ require (
github.com/ipfs/go-datastore v0.5.1
github.com/ipfs/go-ipfs-util v0.0.2
github.com/ipfs/go-log/v2 v2.5.1
github.com/jbenet/go-temp-err-catcher v0.1.0
github.com/klauspost/compress v1.15.1
github.com/libp2p/go-buffer-pool v0.0.2
github.com/libp2p/go-eventbus v0.2.1
@ -22,10 +23,10 @@ require (
github.com/libp2p/go-libp2p-nat v0.1.0
github.com/libp2p/go-libp2p-noise v0.4.0
github.com/libp2p/go-libp2p-peerstore v0.6.0
github.com/libp2p/go-libp2p-pnet v0.2.0
github.com/libp2p/go-libp2p-resource-manager v0.2.1
github.com/libp2p/go-libp2p-testing v0.9.2
github.com/libp2p/go-libp2p-tls v0.4.1
github.com/libp2p/go-libp2p-transport-upgrader v0.7.1
github.com/libp2p/go-mplex v0.7.0
github.com/libp2p/go-msgio v0.2.0
github.com/libp2p/go-netroute v0.2.0
@ -74,16 +75,15 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/klauspost/cpuid/v2 v2.0.12 // indirect
github.com/koron/go-ssdp v0.0.2 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.0.3 // indirect
github.com/libp2p/go-libp2p-blankhost v0.3.0 // indirect
github.com/libp2p/go-libp2p-pnet v0.2.0 // indirect
github.com/libp2p/go-libp2p-quic-transport v0.17.0 // indirect
github.com/libp2p/go-libp2p-swarm v0.10.2 // indirect
github.com/libp2p/go-libp2p-transport-upgrader v0.7.1 // indirect
github.com/libp2p/go-libp2p-yamux v0.9.1 // indirect
github.com/libp2p/go-nat v0.1.0 // indirect
github.com/libp2p/go-openssl v0.0.7 // indirect

1
go.sum

@ -443,7 +443,6 @@ github.com/libp2p/go-libp2p-core v0.14.0/go.mod h1:tLasfcVdTXnixsLB0QYaT1syJOhsb
github.com/libp2p/go-libp2p-core v0.15.1 h1:0RY+Mi/ARK9DgG1g9xVQLb8dDaaU8tCePMtGALEfBnM=
github.com/libp2p/go-libp2p-core v0.15.1/go.mod h1:agSaboYM4hzB1cWekgVReqV5M4g5M+2eNNejV+1EEhs=
github.com/libp2p/go-libp2p-mplex v0.4.1/go.mod h1:cmy+3GfqfM1PceHTLL7zQzAAYaryDu6iPSC+CIb094g=
github.com/libp2p/go-libp2p-mplex v0.5.0 h1:vt3k4E4HSND9XH4Z8rUpacPJFSAgLOv6HDvG8W9Ks9E=
github.com/libp2p/go-libp2p-mplex v0.5.0/go.mod h1:eLImPJLkj3iG5t5lq68w3Vm5NAQ5BcKwrrb2VmOYb3M=
github.com/libp2p/go-libp2p-nat v0.1.0 h1:vigUi2MEN+fwghe5ijpScxtbbDz+L/6y8XwlzYOJgSY=
github.com/libp2p/go-libp2p-nat v0.1.0/go.mod h1:DQzAG+QbDYjN1/C3B6vXucLtz3u9rEonLVPtZVzQqks=

2
p2p/net/swarm/dial_worker_test.go

@ -10,6 +10,7 @@ import (
"github.com/libp2p/go-libp2p/p2p/muxer/yamux"
csms "github.com/libp2p/go-libp2p/p2p/net/conn-security-multistream"
tptu "github.com/libp2p/go-libp2p/p2p/net/upgrader"
quic "github.com/libp2p/go-libp2p/p2p/transport/quic"
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
@ -19,7 +20,6 @@ import (
"github.com/libp2p/go-libp2p-peerstore/pstoremem"
tnet "github.com/libp2p/go-libp2p-testing/net"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
msmux "github.com/libp2p/go-stream-muxer-multistream"
ma "github.com/multiformats/go-multiaddr"

2
p2p/net/swarm/testing/testing.go

@ -7,6 +7,7 @@ import (
"github.com/libp2p/go-libp2p/p2p/muxer/yamux"
csms "github.com/libp2p/go-libp2p/p2p/net/conn-security-multistream"
"github.com/libp2p/go-libp2p/p2p/net/swarm"
tptu "github.com/libp2p/go-libp2p/p2p/net/upgrader"
quic "github.com/libp2p/go-libp2p/p2p/transport/quic"
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
@ -22,7 +23,6 @@ import (
"github.com/libp2p/go-libp2p-peerstore/pstoremem"
tnet "github.com/libp2p/go-libp2p-testing/net"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
msmux "github.com/libp2p/go-stream-muxer-multistream"
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"

2
p2p/net/upgrader/listener_test.go

@ -11,7 +11,7 @@ import (
"testing"
"time"
upgrader "github.com/libp2p/go-libp2p-transport-upgrader"
"github.com/libp2p/go-libp2p/p2p/net/upgrader"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"

8
p2p/net/upgrader/upgrader_test.go

@ -6,7 +6,8 @@ import (
"net"
"testing"
upgrader "github.com/libp2p/go-libp2p-transport-upgrader"
"github.com/libp2p/go-libp2p/p2p/muxer/yamux"
"github.com/libp2p/go-libp2p/p2p/net/upgrader"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/network"
@ -15,7 +16,6 @@ import (
"github.com/libp2p/go-libp2p-core/test"
"github.com/libp2p/go-libp2p-core/transport"
mplex "github.com/libp2p/go-libp2p-mplex"
mocknetwork "github.com/libp2p/go-libp2p-testing/mocks/network"
"github.com/golang/mock/gomock"
@ -39,7 +39,7 @@ func createUpgraderWithMuxer(t *testing.T, muxer network.Multiplexer, opts ...up
return id, u
}
// negotiatingMuxer sets up a new mplex connection
// negotiatingMuxer sets up a new yamux connection
// It makes sure that this happens at the same time for client and server.
type negotiatingMuxer struct{}
@ -54,7 +54,7 @@ func (m *negotiatingMuxer) NewConn(c net.Conn, isServer bool, scope network.Peer
if err != nil {
return nil, err
}
return mplex.DefaultTransport.NewConn(c, isServer, scope)
return yamux.DefaultTransport.NewConn(c, isServer, scope)
}
// blockingMuxer blocks the muxer negotiation until the contain chan is closed

2
p2p/transport/tcp/tcp.go

@ -86,7 +86,7 @@ func (ll *tcpListener) Accept() (manet.Conn, error) {
tryKeepAlive(c, true)
// We're not calling OpenConnection in the resource manager here,
// since the manet.Conn doesn't allow us to save the scope.
// It's the caller's (usually the go-libp2p-transport-upgrader) responsibility
// It's the caller's (usually the p2p/net/upgrader) responsibility
// to call the resource manager.
return c, nil
}

2
p2p/transport/tcp/tcp_test.go

@ -7,6 +7,7 @@ import (
"github.com/libp2p/go-libp2p/p2p/muxer/yamux"
csms "github.com/libp2p/go-libp2p/p2p/net/conn-security-multistream"
tptu "github.com/libp2p/go-libp2p/p2p/net/upgrader"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/network"
@ -17,7 +18,6 @@ import (
mocknetwork "github.com/libp2p/go-libp2p-testing/mocks/network"
ttransport "github.com/libp2p/go-libp2p-testing/suites/transport"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
ma "github.com/multiformats/go-multiaddr"

2
p2p/transport/websocket/websocket_test.go

@ -16,6 +16,7 @@ import (
"time"
csms "github.com/libp2p/go-libp2p/p2p/net/conn-security-multistream"
tptu "github.com/libp2p/go-libp2p/p2p/net/upgrader"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/network"
@ -27,7 +28,6 @@ import (
"github.com/libp2p/go-libp2p/p2p/muxer/yamux"
ttransport "github.com/libp2p/go-libp2p-testing/suites/transport"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"

Loading…
Cancel
Save