Skip to content

Commit

Permalink
WIP: prepare update to go-libp2p v0.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Jan 15, 2022
1 parent 6c6f368 commit 7bd8191
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 64 deletions.
10 changes: 5 additions & 5 deletions core/coreapi/test/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"

"github.com/ipfs/go-filestore"
"github.com/ipfs/go-ipfs-keystore"
keystore "github.com/ipfs/go-ipfs-keystore"
"github.com/ipfs/go-ipfs/core"
"github.com/ipfs/go-ipfs/core/bootstrap"
"github.com/ipfs/go-ipfs/core/coreapi"
Expand All @@ -19,20 +19,20 @@ import (

"github.com/ipfs/go-datastore"
syncds "github.com/ipfs/go-datastore/sync"
"github.com/ipfs/go-ipfs-config"
config "github.com/ipfs/go-ipfs-config"
coreiface "github.com/ipfs/interface-go-ipfs-core"
"github.com/ipfs/interface-go-ipfs-core/tests"
"github.com/libp2p/go-libp2p-core/crypto"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/p2p/net/mock"
"github.com/libp2p/go-libp2p-core/peer"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
)

const testPeerID = "QmTFauExutTsy4XP6JbMFcw2Wa9645HJt2bTqL6qYDCKfe"

type NodeProvider struct{}

func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) {
mn := mocknet.New(ctx)
mn := mocknet.New()

nodes := make([]*core.IpfsNode, n)
apis := make([]coreiface.CoreAPI, n)
Expand Down
6 changes: 2 additions & 4 deletions core/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ import (

// NewMockNode constructs an IpfsNode for use in tests.
func NewMockNode() (*core.IpfsNode, error) {
ctx := context.Background()

// effectively offline, only peer in its network
return core.NewNode(ctx, &core.BuildCfg{
return core.NewNode(context.Background(), &core.BuildCfg{
Online: true,
Host: MockHostOption(mocknet.New(ctx)),
Host: MockHostOption(mocknet.New()),
})
}

Expand Down
4 changes: 2 additions & 2 deletions core/node/libp2p/smux.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

config "github.com/ipfs/go-ipfs-config"
"github.com/libp2p/go-libp2p"
smux "github.com/libp2p/go-libp2p-core/mux"
"github.com/libp2p/go-libp2p-core/network"
mplex "github.com/libp2p/go-libp2p-mplex"
yamux "github.com/libp2p/go-libp2p-yamux"
)

func yamuxTransport() smux.Multiplexer {
func yamuxTransport() network.Multiplexer {
tpt := *yamux.DefaultTransport
tpt.AcceptBacklog = 512
if os.Getenv("YAMUX_DEBUG") != "" {
Expand Down
22 changes: 11 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -66,32 +66,32 @@ require (
github.com/jbenet/go-temp-err-catcher v0.1.0
github.com/jbenet/goprocess v0.1.4
github.com/libp2p/go-doh-resolver v0.3.1
github.com/libp2p/go-libp2p v0.16.1-0.20211214061227-980033efd181
github.com/libp2p/go-libp2p-connmgr v0.3.0
github.com/libp2p/go-libp2p-core v0.13.0
github.com/libp2p/go-libp2p v0.17.1-0.20220115114156-5f2d064604c1
github.com/libp2p/go-libp2p-connmgr v0.3.2-0.20220115145817-a7820a5879c7
github.com/libp2p/go-libp2p-core v0.13.1-0.20220114101623-6b8d8bf59647
github.com/libp2p/go-libp2p-discovery v0.6.0
github.com/libp2p/go-libp2p-http v0.2.1
github.com/libp2p/go-libp2p-kad-dht v0.15.0
github.com/libp2p/go-libp2p-kbucket v0.4.7
github.com/libp2p/go-libp2p-loggables v0.1.0
github.com/libp2p/go-libp2p-mplex v0.4.1
github.com/libp2p/go-libp2p-mplex v0.4.2-0.20220113124821-8bd3fd12e637
github.com/libp2p/go-libp2p-noise v0.3.0
github.com/libp2p/go-libp2p-peerstore v0.6.0
github.com/libp2p/go-libp2p-pubsub v0.6.0
github.com/libp2p/go-libp2p-pubsub-router v0.5.0
github.com/libp2p/go-libp2p-quic-transport v0.15.2
github.com/libp2p/go-libp2p-quic-transport v0.15.1-0.20220115163217-d8ebfeffe1f5
github.com/libp2p/go-libp2p-record v0.1.3
github.com/libp2p/go-libp2p-routing-helpers v0.2.3
github.com/libp2p/go-libp2p-swarm v0.9.0
github.com/libp2p/go-libp2p-testing v0.6.0
github.com/libp2p/go-libp2p-swarm v0.9.1-0.20220114122938-ef54b2f2246b
github.com/libp2p/go-libp2p-testing v0.6.1-0.20220114111157-d4fb83f89618
github.com/libp2p/go-libp2p-tls v0.3.1
github.com/libp2p/go-libp2p-yamux v0.7.0
github.com/libp2p/go-libp2p-yamux v0.7.1-0.20220113124110-6ee26a611de0
github.com/libp2p/go-socket-activation v0.1.0
github.com/libp2p/go-tcp-transport v0.4.0
github.com/libp2p/go-ws-transport v0.5.0
github.com/libp2p/go-tcp-transport v0.4.1-0.20220114115510-e760df1f0b84
github.com/libp2p/go-ws-transport v0.5.1-0.20220104130611-c4b67dc94623
github.com/miekg/dns v1.1.43
github.com/mitchellh/go-homedir v1.1.0
github.com/multiformats/go-multiaddr v0.4.1
github.com/multiformats/go-multiaddr v0.5.0
github.com/multiformats/go-multiaddr-dns v0.3.1
github.com/multiformats/go-multibase v0.0.3
github.com/multiformats/go-multicodec v0.3.0
Expand Down
84 changes: 53 additions & 31 deletions go.sum

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions test/integration/addcat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
mock "github.com/ipfs/go-ipfs/core/mock"
"github.com/ipfs/go-ipfs/thirdparty/unit"
logging "github.com/ipfs/go-log"
random "github.com/jbenet/go-random"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/jbenet/go-random"
"github.com/libp2p/go-libp2p-core/peer"
testutil "github.com/libp2p/go-libp2p-testing/net"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
)
Expand Down Expand Up @@ -97,7 +97,7 @@ func DirectAddCat(data []byte, conf testutil.LatencyConfig) error {
defer cancel()

// create network
mn := mocknet.New(ctx)
mn := mocknet.New()
mn.SetLinkDefaults(mocknet.LinkOptions{
Latency: conf.NetworkLatency,
// TODO add to conf. This is tricky because we want 0 values to be functional.
Expand Down
4 changes: 2 additions & 2 deletions test/integration/bench_cat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/ipfs/go-ipfs/core/coreapi"
mock "github.com/ipfs/go-ipfs/core/mock"
"github.com/ipfs/go-ipfs/thirdparty/unit"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peer"
testutil "github.com/libp2p/go-libp2p-testing/net"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
)
Expand All @@ -40,7 +40,7 @@ func benchCat(b *testing.B, data []byte, conf testutil.LatencyConfig) error {
defer cancel()

// create network
mn := mocknet.New(ctx)
mn := mocknet.New()
mn.SetLinkDefaults(mocknet.LinkOptions{
Latency: conf.NetworkLatency,
// TODO add to conf. This is tricky because we want 0 values to be functional.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/bitswap_wo_routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestBitswapWithoutRouting(t *testing.T) {
const numPeers = 4

// create network
mn := mocknet.New(ctx)
mn := mocknet.New()

var nodes []*core.IpfsNode
for i := 0; i < numPeers; i++ {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/three_legged_cat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/ipfs/go-ipfs/thirdparty/unit"

files "github.com/ipfs/go-ipfs-files"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peer"
testutil "github.com/libp2p/go-libp2p-testing/net"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
)
Expand Down Expand Up @@ -68,7 +68,7 @@ func RunThreeLeggedCat(data []byte, conf testutil.LatencyConfig) error {
defer cancel()

// create network
mn := mocknet.New(ctx)
mn := mocknet.New()
mn.SetLinkDefaults(mocknet.LinkOptions{
Latency: conf.NetworkLatency,
// TODO add to conf. This is tricky because we want 0 values to be functional.
Expand Down
6 changes: 3 additions & 3 deletions test/integration/wan_lan_dht_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func RunDHTConnectivity(conf testutil.LatencyConfig, numPeers int) error {
defer cancel()

// create network
mn := mocknet.New(ctx)
mn := mocknet.New()
mn.SetLinkDefaults(mocknet.LinkOptions{
Latency: conf.NetworkLatency,
Bandwidth: math.MaxInt32,
Expand Down Expand Up @@ -209,9 +209,9 @@ WanStartupWait:
for {
select {
case err := <-testPeer.DHT.WAN.RefreshRoutingTable():
//if err != nil {
// if err != nil {
// fmt.Printf("Error refreshing routing table: %v\n", err)
//}
// }
if testPeer.DHT.WAN.RoutingTable() == nil ||
testPeer.DHT.WAN.RoutingTable().Size() == 0 ||
err != nil {
Expand Down

0 comments on commit 7bd8191

Please sign in to comment.