Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
migrate to consolidated types; remove CircleCI config (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk authored May 26, 2019
1 parent 72a8013 commit 9983144
Show file tree
Hide file tree
Showing 23 changed files with 266 additions and 276 deletions.
10 changes: 0 additions & 10 deletions .circleci/config.yml

This file was deleted.

3 changes: 2 additions & 1 deletion dial_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"fmt"
"strings"

peer "github.com/libp2p/go-libp2p-peer"
"github.com/libp2p/go-libp2p-core/peer"

ma "github.com/multiformats/go-multiaddr"
)

Expand Down
2 changes: 1 addition & 1 deletion dial_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"sync"

peer "github.com/libp2p/go-libp2p-peer"
"github.com/libp2p/go-libp2p-core/peer"
)

// DialFunc is the type of function expected by DialSync.
Expand Down
2 changes: 1 addition & 1 deletion dial_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

. "github.com/libp2p/go-libp2p-swarm"

peer "github.com/libp2p/go-libp2p-peer"
"github.com/libp2p/go-libp2p-core/peer"
)

func getMockDialFunc() (DialFunc, func(), context.Context, <-chan struct{}) {
Expand Down
31 changes: 17 additions & 14 deletions dial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ import (
"time"

addrutil "github.com/libp2p/go-addr-util"
peer "github.com/libp2p/go-libp2p-peer"
pstore "github.com/libp2p/go-libp2p-peerstore"

"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peerstore"
"github.com/libp2p/go-libp2p-core/transport"

testutil "github.com/libp2p/go-libp2p-core/test"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
transport "github.com/libp2p/go-libp2p-transport"
testutil "github.com/libp2p/go-testutil"
ci "github.com/libp2p/go-testutil/ci"
"github.com/libp2p/go-libp2p-testing/ci"

ma "github.com/multiformats/go-multiaddr"
manet "github.com/multiformats/go-multiaddr-net"

Expand All @@ -39,7 +42,7 @@ func TestBasicDialPeer(t *testing.T) {
s1 := swarms[0]
s2 := swarms[1]

s1.Peerstore().AddAddrs(s2.LocalPeer(), s2.ListenAddresses(), pstore.PermanentAddrTTL)
s1.Peerstore().AddAddrs(s2.LocalPeer(), s2.ListenAddresses(), peerstore.PermanentAddrTTL)

c, err := s1.DialPeer(ctx, s2.LocalPeer())
if err != nil {
Expand All @@ -64,7 +67,7 @@ func TestDialWithNoListeners(t *testing.T) {
defer closeSwarms(swarms)
s2 := swarms[0]

s1.Peerstore().AddAddrs(s2.LocalPeer(), s2.ListenAddresses(), pstore.PermanentAddrTTL)
s1.Peerstore().AddAddrs(s2.LocalPeer(), s2.ListenAddresses(), peerstore.PermanentAddrTTL)

c, err := s1.DialPeer(ctx, s2.LocalPeer())
if err != nil {
Expand Down Expand Up @@ -108,7 +111,7 @@ func TestSimultDials(t *testing.T) {
connect := func(s *Swarm, dst peer.ID, addr ma.Multiaddr) {
// copy for other peer
log.Debugf("TestSimultOpen: connecting: %s --> %s (%s)", s.LocalPeer(), dst, addr)
s.Peerstore().AddAddr(dst, addr, pstore.TempAddrTTL)
s.Peerstore().AddAddr(dst, addr, peerstore.TempAddrTTL)
if _, err := s.DialPeer(ctx, dst); err != nil {
t.Fatal("error swarm dialing to peer", err)
}
Expand Down Expand Up @@ -179,7 +182,7 @@ func TestDialWait(t *testing.T) {
s2p, s2addr, s2l := newSilentPeer(t)
go acceptAndHang(s2l)
defer s2l.Close()
s1.Peerstore().AddAddr(s2p, s2addr, pstore.PermanentAddrTTL)
s1.Peerstore().AddAddr(s2p, s2addr, peerstore.PermanentAddrTTL)

before := time.Now()
if c, err := s1.DialPeer(ctx, s2p); err == nil {
Expand Down Expand Up @@ -221,13 +224,13 @@ func TestDialBackoff(t *testing.T) {
if err != nil {
t.Fatal(err)
}
s1.Peerstore().AddAddrs(s2.LocalPeer(), s2addrs, pstore.PermanentAddrTTL)
s1.Peerstore().AddAddrs(s2.LocalPeer(), s2addrs, peerstore.PermanentAddrTTL)

// dial to a non-existent peer.
s3p, s3addr, s3l := newSilentPeer(t)
go acceptAndHang(s3l)
defer s3l.Close()
s1.Peerstore().AddAddr(s3p, s3addr, pstore.PermanentAddrTTL)
s1.Peerstore().AddAddr(s3p, s3addr, peerstore.PermanentAddrTTL)

// in this test we will:
// 1) dial 10x to each node.
Expand Down Expand Up @@ -430,7 +433,7 @@ func TestDialBackoffClears(t *testing.T) {
defer s2l.Close()

// phase 1 -- dial to non-operational addresses
s1.Peerstore().AddAddr(s2.LocalPeer(), s2bad, pstore.PermanentAddrTTL)
s1.Peerstore().AddAddr(s2.LocalPeer(), s2bad, peerstore.PermanentAddrTTL)

before := time.Now()
if c, err := s1.DialPeer(ctx, s2.LocalPeer()); err == nil {
Expand Down Expand Up @@ -459,7 +462,7 @@ func TestDialBackoffClears(t *testing.T) {
if err != nil {
t.Fatal(err)
}
s1.Peerstore().AddAddrs(s2.LocalPeer(), ifaceAddrs1, pstore.PermanentAddrTTL)
s1.Peerstore().AddAddrs(s2.LocalPeer(), ifaceAddrs1, peerstore.PermanentAddrTTL)

if _, err := s1.DialPeer(ctx, s2.LocalPeer()); err == nil {
t.Fatal("should have failed to dial backed off peer")
Expand Down Expand Up @@ -498,7 +501,7 @@ func TestDialPeerFailed(t *testing.T) {
testedSwarm.Peerstore().AddAddr(
targetSwarm.LocalPeer(),
silentPeerAddress,
pstore.PermanentAddrTTL)
peerstore.PermanentAddrTTL)
}

_, err := testedSwarm.DialPeer(ctx, targetSwarm.LocalPeer())
Expand Down
28 changes: 10 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
module github.com/libp2p/go-libp2p-swarm

go 1.12

require (
github.com/ipfs/go-log v0.0.1
github.com/jbenet/goprocess v0.1.3
github.com/libp2p/go-addr-util v0.0.1
github.com/libp2p/go-conn-security-multistream v0.0.2
github.com/libp2p/go-libp2p-crypto v0.0.2
github.com/libp2p/go-libp2p-loggables v0.0.1
github.com/libp2p/go-libp2p-metrics v0.0.1
github.com/libp2p/go-libp2p-net v0.0.2
github.com/libp2p/go-libp2p-peer v0.1.1
github.com/libp2p/go-libp2p-peerstore v0.0.6
github.com/libp2p/go-libp2p-protocol v0.0.1
github.com/libp2p/go-libp2p-secio v0.0.3
github.com/libp2p/go-libp2p-transport v0.0.5
github.com/libp2p/go-libp2p-transport-upgrader v0.0.4
github.com/libp2p/go-libp2p-yamux v0.1.2
github.com/libp2p/go-conn-security-multistream v0.1.0
github.com/libp2p/go-libp2p-core v0.0.1
github.com/libp2p/go-libp2p-loggables v0.1.0
github.com/libp2p/go-libp2p-peerstore v0.1.0
github.com/libp2p/go-libp2p-secio v0.1.0
github.com/libp2p/go-libp2p-testing v0.0.3
github.com/libp2p/go-libp2p-transport-upgrader v0.1.1
github.com/libp2p/go-libp2p-yamux v0.2.0
github.com/libp2p/go-maddr-filter v0.0.4
github.com/libp2p/go-stream-muxer v0.0.1
github.com/libp2p/go-stream-muxer-multistream v0.1.1
github.com/libp2p/go-tcp-transport v0.0.4
github.com/libp2p/go-testutil v0.0.1
github.com/libp2p/go-stream-muxer-multistream v0.2.0
github.com/libp2p/go-tcp-transport v0.1.0
github.com/multiformats/go-multiaddr v0.0.4
github.com/multiformats/go-multiaddr-net v0.0.1
github.com/whyrusleeping/mafmt v1.2.8
Expand Down
Loading

0 comments on commit 9983144

Please sign in to comment.