Browse Source

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

pull/1414/head
Marten Seemann 3 years ago
parent
commit
3effab121a
  1. 2
      config/config.go
  2. 6
      config/muxer_test.go
  3. 6
      go.mod
  4. 3
      p2p/discovery/backoff/backoffcache_test.go
  5. 3
      p2p/discovery/backoff/backoffconnector_test.go
  6. 9
      p2p/discovery/mdns_legacy/mdns_test.go
  7. 2
      p2p/discovery/routing/routing_test.go
  8. 2
      p2p/host/autonat/autonat_test.go
  9. 6
      p2p/host/autonat/dialpolicy_test.go
  10. 3
      p2p/host/autonat/svc_test.go
  11. 9
      p2p/host/basic/basic_host_test.go
  12. 3
      p2p/host/basic/peer_connectedness_test.go
  13. 3
      p2p/host/blank/peer_connectedness_test.go
  14. 6
      p2p/net/swarm/dial_test.go
  15. 2
      p2p/net/swarm/peers_test.go
  16. 8
      p2p/net/swarm/simul_test.go
  17. 6
      p2p/net/swarm/swarm_addr_test.go
  18. 4
      p2p/net/swarm/swarm_net_test.go
  19. 4
      p2p/net/swarm/swarm_notif_test.go
  20. 4
      p2p/net/swarm/swarm_test.go
  21. 3
      p2p/net/swarm/testing/testing.go
  22. 4
      p2p/net/swarm/transport_test.go
  23. 6
      p2p/protocol/circuitv2/relay/relay_test.go
  24. 3
      p2p/protocol/identify/id_glass_test.go
  25. 2
      p2p/protocol/identify/id_test.go
  26. 3
      p2p/protocol/identify/peer_loop_test.go
  27. 5
      p2p/protocol/ping/ping_test.go
  28. 9
      p2p/test/backpressure/backpressure_test.go
  29. 3
      p2p/test/reconnects/reconnect_test.go

2
config/config.go

@ -23,11 +23,11 @@ import (
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
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"
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"
swarm "github.com/libp2p/go-libp2p-swarm"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
logging "github.com/ipfs/go-log/v2"

6
config/muxer_test.go

@ -3,12 +3,12 @@ package config
import (
"testing"
"github.com/libp2p/go-libp2p-core/network"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
yamux "github.com/libp2p/go-libp2p-yamux"
)

6
go.mod

@ -22,7 +22,6 @@ require (
github.com/libp2p/go-libp2p-peerstore v0.6.0
github.com/libp2p/go-libp2p-quic-transport v0.17.0
github.com/libp2p/go-libp2p-resource-manager v0.2.1
github.com/libp2p/go-libp2p-swarm v0.10.2
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
@ -35,12 +34,14 @@ require (
github.com/libp2p/zeroconf/v2 v2.1.1
github.com/multiformats/go-multiaddr v0.5.0
github.com/multiformats/go-multiaddr-dns v0.3.1
github.com/multiformats/go-multiaddr-fmt v0.1.0
github.com/multiformats/go-multihash v0.1.0
github.com/multiformats/go-multistream v0.3.0
github.com/multiformats/go-varint v0.0.6
github.com/raulk/go-watchdog v1.2.0
github.com/stretchr/testify v1.7.0
github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
)
@ -76,6 +77,7 @@ require (
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-swarm v0.10.2 // indirect
github.com/libp2p/go-nat v0.1.0 // indirect
github.com/libp2p/go-openssl v0.0.7 // indirect
github.com/libp2p/go-reuseport v0.1.0 // indirect
@ -96,7 +98,6 @@ require (
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.0.4 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect
github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect
github.com/multiformats/go-multibase v0.0.3 // indirect
github.com/multiformats/go-multicodec v0.4.1 // indirect
github.com/nxadm/tail v1.4.8 // indirect
@ -112,7 +113,6 @@ require (
github.com/raulk/clock v1.1.0 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect

3
p2p/discovery/backoff/backoffcache_test.go

@ -9,11 +9,10 @@ import (
"github.com/libp2p/go-libp2p/p2p/discovery/mocks"
bhost "github.com/libp2p/go-libp2p/p2p/host/blank"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/discovery"
"github.com/libp2p/go-libp2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
)
type delayedDiscovery struct {

3
p2p/discovery/backoff/backoffconnector_test.go

@ -8,12 +8,11 @@ import (
"time"
bhost "github.com/libp2p/go-libp2p/p2p/host/blank"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/stretchr/testify/require"
)

9
p2p/discovery/mdns_legacy/mdns_test.go

@ -5,12 +5,13 @@ import (
"testing"
"time"
"github.com/stretchr/testify/require"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
"github.com/stretchr/testify/require"
)
type DiscoveryNotifee struct {
@ -22,7 +23,7 @@ func (n *DiscoveryNotifee) HandlePeerFound(pi peer.AddrInfo) {
}
func TestMdnsDiscovery(t *testing.T) {
//TODO: re-enable when the new lib will get integrated
// TODO: re-enable when the new lib will get integrated
t.Skip("TestMdnsDiscovery fails randomly with current lib")
ctx, cancel := context.WithCancel(context.Background())

2
p2p/discovery/routing/routing_test.go

@ -9,12 +9,12 @@ import (
"github.com/libp2p/go-libp2p/p2p/discovery/mocks"
"github.com/libp2p/go-libp2p/p2p/discovery/util"
bhost "github.com/libp2p/go-libp2p/p2p/host/blank"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/discovery"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
)
type mockRoutingTable struct {

2
p2p/host/autonat/autonat_test.go

@ -7,13 +7,13 @@ import (
pb "github.com/libp2p/go-libp2p/p2p/host/autonat/pb"
bhost "github.com/libp2p/go-libp2p/p2p/host/blank"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/event"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/libp2p/go-msgio/protoio"
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"

6
p2p/host/autonat/dialpolicy_test.go

@ -6,10 +6,12 @@ import (
"net"
"testing"
blankhost "github.com/libp2p/go-libp2p/p2p/host/blank"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/transport"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
blankhost "github.com/libp2p/go-libp2p/p2p/host/blank"
"github.com/multiformats/go-multiaddr"
)

3
p2p/host/autonat/svc_test.go

@ -7,13 +7,12 @@ import (
"time"
bhost "github.com/libp2p/go-libp2p/p2p/host/blank"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/event"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"
)

9
p2p/host/basic/basic_host_test.go

@ -11,7 +11,10 @@ import (
"testing"
"time"
"github.com/libp2p/go-eventbus"
"github.com/libp2p/go-libp2p/p2p/host/autonat"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p/p2p/protocol/identify"
"github.com/libp2p/go-libp2p-core/event"
"github.com/libp2p/go-libp2p-core/helpers"
"github.com/libp2p/go-libp2p-core/host"
@ -21,10 +24,8 @@ import (
"github.com/libp2p/go-libp2p-core/protocol"
"github.com/libp2p/go-libp2p-core/record"
"github.com/libp2p/go-libp2p-core/test"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/libp2p/go-libp2p/p2p/host/autonat"
"github.com/libp2p/go-libp2p/p2p/protocol/identify"
"github.com/libp2p/go-eventbus"
ma "github.com/multiformats/go-multiaddr"
madns "github.com/multiformats/go-multiaddr-dns"

3
p2p/host/basic/peer_connectedness_test.go

@ -5,10 +5,11 @@ import (
"testing"
"time"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/event"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/stretchr/testify/require"
)

3
p2p/host/blank/peer_connectedness_test.go

@ -5,10 +5,11 @@ import (
"testing"
"time"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/event"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/stretchr/testify/require"
)

6
p2p/net/swarm/dial_test.go

@ -7,15 +7,15 @@ import (
"testing"
"time"
. "github.com/libp2p/go-libp2p-swarm"
. "github.com/libp2p/go-libp2p/p2p/net/swarm"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peerstore"
testutil "github.com/libp2p/go-libp2p-core/test"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/libp2p/go-libp2p-testing/ci"
"github.com/libp2p/go-libp2p-testing/ci"
ma "github.com/multiformats/go-multiaddr"
manet "github.com/multiformats/go-multiaddr/net"

2
p2p/net/swarm/peers_test.go

@ -5,7 +5,7 @@ import (
"testing"
"time"
. "github.com/libp2p/go-libp2p-swarm"
. "github.com/libp2p/go-libp2p/p2p/net/swarm"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peerstore"

8
p2p/net/swarm/simul_test.go

@ -7,14 +7,14 @@ import (
"testing"
"time"
. "github.com/libp2p/go-libp2p/p2p/net/swarm"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peerstore"
ma "github.com/multiformats/go-multiaddr"
. "github.com/libp2p/go-libp2p-swarm"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/libp2p/go-libp2p-testing/ci"
ma "github.com/multiformats/go-multiaddr"
)
func TestSimultOpen(t *testing.T) {

6
p2p/net/swarm/swarm_addr_test.go

@ -4,13 +4,13 @@ import (
"context"
"testing"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/peerstore"
"github.com/libp2p/go-libp2p-core/test"
"github.com/stretchr/testify/require"
ma "github.com/multiformats/go-multiaddr"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/stretchr/testify/require"
)
func TestDialBadAddrs(t *testing.T) {

4
p2p/net/swarm/swarm_net_test.go

@ -7,11 +7,11 @@ import (
"testing"
"time"
"github.com/stretchr/testify/require"
. "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/network"
. "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/stretchr/testify/require"
)
// TestConnectednessCorrect starts a few networks, connects a few

4
p2p/net/swarm/swarm_notif_test.go

@ -5,14 +5,14 @@ import (
"testing"
"time"
"github.com/stretchr/testify/require"
. "github.com/libp2p/go-libp2p/p2p/net/swarm"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
ma "github.com/multiformats/go-multiaddr"
. "github.com/libp2p/go-libp2p-swarm"
"github.com/stretchr/testify/require"
)
func TestNotifications(t *testing.T) {

4
p2p/net/swarm/swarm_test.go

@ -13,8 +13,8 @@ import (
"github.com/libp2p/go-libp2p-core/protocol"
swarm "github.com/libp2p/go-libp2p-swarm"
. "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/libp2p/go-libp2p/p2p/net/swarm"
. "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/control"
"github.com/libp2p/go-libp2p-core/network"

3
p2p/net/swarm/testing/testing.go

@ -4,6 +4,8 @@ import (
"testing"
"time"
"github.com/libp2p/go-libp2p/p2p/net/swarm"
"github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/control"
"github.com/libp2p/go-libp2p-core/crypto"
@ -18,7 +20,6 @@ import (
csms "github.com/libp2p/go-conn-security-multistream"
"github.com/libp2p/go-libp2p-peerstore/pstoremem"
quic "github.com/libp2p/go-libp2p-quic-transport"
swarm "github.com/libp2p/go-libp2p-swarm"
tnet "github.com/libp2p/go-libp2p-testing/net"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
yamux "github.com/libp2p/go-libp2p-yamux"

4
p2p/net/swarm/transport_test.go

@ -4,8 +4,8 @@ import (
"context"
"testing"
swarm "github.com/libp2p/go-libp2p-swarm"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/libp2p/go-libp2p/p2p/net/swarm"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/transport"

6
p2p/protocol/circuitv2/relay/relay_test.go

@ -10,19 +10,19 @@ import (
"time"
bhost "github.com/libp2p/go-libp2p/p2p/host/blank"
"github.com/libp2p/go-libp2p/p2p/net/swarm"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client"
"github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/relay"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/metrics"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/transport"
"github.com/libp2p/go-libp2p-core/metrics"
"github.com/libp2p/go-libp2p-peerstore/pstoremem"
swarm "github.com/libp2p/go-libp2p-swarm"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/libp2p/go-tcp-transport"
ma "github.com/multiformats/go-multiaddr"
)

3
p2p/protocol/identify/id_glass_test.go

@ -6,12 +6,11 @@ import (
"time"
blhost "github.com/libp2p/go-libp2p/p2p/host/blank"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

2
p2p/protocol/identify/id_test.go

@ -12,6 +12,7 @@ import (
"github.com/libp2p/go-libp2p"
blhost "github.com/libp2p/go-libp2p/p2p/host/blank"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p/p2p/protocol/identify"
pb "github.com/libp2p/go-libp2p/p2p/protocol/identify/pb"
@ -27,7 +28,6 @@ import (
"github.com/libp2p/go-eventbus"
"github.com/libp2p/go-libp2p-peerstore/pstoremem"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/libp2p/go-libp2p-testing/race"
"github.com/libp2p/go-msgio/protoio"

3
p2p/protocol/identify/peer_loop_test.go

@ -6,12 +6,11 @@ import (
"time"
blhost "github.com/libp2p/go-libp2p/p2p/host/blank"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/stretchr/testify/require"
)

5
p2p/protocol/ping/ping_test.go

@ -7,10 +7,11 @@ import (
"github.com/stretchr/testify/require"
"github.com/libp2p/go-libp2p-core/peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p/p2p/protocol/ping"
"github.com/libp2p/go-libp2p-core/peer"
)
func TestPing(t *testing.T) {

9
p2p/test/backpressure/backpressure_test.go

@ -6,13 +6,14 @@ import (
"testing"
"time"
"github.com/stretchr/testify/require"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
logging "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/protocol"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
logging "github.com/ipfs/go-log/v2"
"github.com/stretchr/testify/require"
)
var log = logging.Logger("backpressure")

3
p2p/test/reconnects/reconnect_test.go

@ -10,14 +10,13 @@ import (
"time"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
"github.com/stretchr/testify/require"
)

Loading…
Cancel
Save