Unverified Commit 49274b0e authored by Raúl Kripalani's avatar Raúl Kripalani Committed by GitHub

migrate to consolidated types. (#185)

parent 08ddcf7b
......@@ -2,7 +2,7 @@ package pubsub
import (
lru "github.com/hashicorp/golang-lru"
peer "github.com/libp2p/go-libp2p-peer"
"github.com/libp2p/go-libp2p-core/peer"
)
// Blacklist is an interface for peer blacklisting.
......
......@@ -5,7 +5,7 @@ import (
"testing"
"time"
peer "github.com/libp2p/go-libp2p-peer"
"github.com/libp2p/go-libp2p-core/peer"
)
func TestMapBlacklist(t *testing.T) {
......
......@@ -5,12 +5,14 @@ import (
"context"
"io"
pb "github.com/libp2p/go-libp2p-pubsub/pb"
"github.com/libp2p/go-libp2p-core/helpers"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
ggio "github.com/gogo/protobuf/io"
proto "github.com/gogo/protobuf/proto"
inet "github.com/libp2p/go-libp2p-net"
peer "github.com/libp2p/go-libp2p-peer"
pb "github.com/libp2p/go-libp2p-pubsub/pb"
ms "github.com/multiformats/go-multistream"
)
......@@ -27,7 +29,7 @@ func (p *PubSub) getHelloPacket() *RPC {
return &rpc
}
func (p *PubSub) handleNewStream(s inet.Stream) {
func (p *PubSub) handleNewStream(s network.Stream) {
r := ggio.NewDelimitedReader(s, 1<<20)
for {
rpc := new(RPC)
......@@ -82,7 +84,7 @@ func (p *PubSub) handleNewPeer(ctx context.Context, pid peer.ID, outgoing <-chan
}
}
func (p *PubSub) handlePeerEOF(ctx context.Context, s inet.Stream) {
func (p *PubSub) handlePeerEOF(ctx context.Context, s network.Stream) {
r := ggio.NewDelimitedReader(s, 1<<20)
rpc := new(RPC)
for {
......@@ -98,7 +100,7 @@ func (p *PubSub) handlePeerEOF(ctx context.Context, s inet.Stream) {
}
}
func (p *PubSub) handleSendingMessages(ctx context.Context, s inet.Stream, outgoing <-chan *RPC) {
func (p *PubSub) handleSendingMessages(ctx context.Context, s network.Stream, outgoing <-chan *RPC) {
bufw := bufio.NewWriter(s)
wc := ggio.NewDelimitedWriter(bufw)
......@@ -111,7 +113,7 @@ func (p *PubSub) handleSendingMessages(ctx context.Context, s inet.Stream, outgo
return bufw.Flush()
}
defer inet.FullClose(s)
defer helpers.FullClose(s)
for {
select {
case rpc, ok := <-outgoing:
......
......@@ -5,9 +5,9 @@ import (
pb "github.com/libp2p/go-libp2p-pubsub/pb"
host "github.com/libp2p/go-libp2p-host"
peer "github.com/libp2p/go-libp2p-peer"
protocol "github.com/libp2p/go-libp2p-protocol"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
)
const (
......
......@@ -11,9 +11,10 @@ import (
"time"
bhost "github.com/libp2p/go-libp2p-blankhost"
host "github.com/libp2p/go-libp2p-host"
peer "github.com/libp2p/go-libp2p-peer"
protocol "github.com/libp2p/go-libp2p-protocol"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
)
......
This diff is collapsed.
......@@ -8,9 +8,9 @@ import (
pb "github.com/libp2p/go-libp2p-pubsub/pb"
host "github.com/libp2p/go-libp2p-host"
peer "github.com/libp2p/go-libp2p-peer"
protocol "github.com/libp2p/go-libp2p-protocol"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
)
const (
......
......@@ -8,7 +8,7 @@ import (
"testing"
"time"
host "github.com/libp2p/go-libp2p-host"
"github.com/libp2p/go-libp2p-core/host"
)
func getGossipsubs(ctx context.Context, hs []host.Host, opts ...Option) []*PubSub {
......
package pubsub
import (
inet "github.com/libp2p/go-libp2p-net"
"github.com/libp2p/go-libp2p-core/network"
ma "github.com/multiformats/go-multiaddr"
)
var _ inet.Notifiee = (*PubSubNotif)(nil)
var _ network.Notifiee = (*PubSubNotif)(nil)
type PubSubNotif PubSub
func (p *PubSubNotif) OpenedStream(n inet.Network, s inet.Stream) {
func (p *PubSubNotif) OpenedStream(n network.Network, s network.Stream) {
}
func (p *PubSubNotif) ClosedStream(n inet.Network, s inet.Stream) {
func (p *PubSubNotif) ClosedStream(n network.Network, s network.Stream) {
}
func (p *PubSubNotif) Connected(n inet.Network, c inet.Conn) {
func (p *PubSubNotif) Connected(n network.Network, c network.Conn) {
go func() {
select {
case p.newPeers <- c.RemotePeer():
......@@ -24,11 +24,11 @@ func (p *PubSubNotif) Connected(n inet.Network, c inet.Conn) {
}()
}
func (p *PubSubNotif) Disconnected(n inet.Network, c inet.Conn) {
func (p *PubSubNotif) Disconnected(n network.Network, c network.Conn) {
}
func (p *PubSubNotif) Listen(n inet.Network, _ ma.Multiaddr) {
func (p *PubSubNotif) Listen(n network.Network, _ ma.Multiaddr) {
}
func (p *PubSubNotif) ListenClose(n inet.Network, _ ma.Multiaddr) {
func (p *PubSubNotif) ListenClose(n network.Network, _ ma.Multiaddr) {
}
......@@ -11,12 +11,13 @@ import (
pb "github.com/libp2p/go-libp2p-pubsub/pb"
"github.com/libp2p/go-libp2p-core/crypto"
"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"
logging "github.com/ipfs/go-log"
crypto "github.com/libp2p/go-libp2p-crypto"
host "github.com/libp2p/go-libp2p-host"
inet "github.com/libp2p/go-libp2p-net"
peer "github.com/libp2p/go-libp2p-peer"
protocol "github.com/libp2p/go-libp2p-protocol"
timecache "github.com/whyrusleeping/timecache"
)
......@@ -63,7 +64,7 @@ type PubSub struct {
newPeers chan peer.ID
// a notification channel for new outoging peer streams
newPeerStream chan inet.Stream
newPeerStream chan network.Stream
// a notification channel for errors opening new peer streams
newPeerError chan peer.ID
......@@ -162,7 +163,7 @@ func NewPubSub(ctx context.Context, h host.Host, rt PubSubRouter, opts ...Option
incoming: make(chan *RPC, 32),
publish: make(chan *Message),
newPeers: make(chan peer.ID),
newPeerStream: make(chan inet.Stream),
newPeerStream: make(chan network.Stream),
newPeerError: make(chan peer.ID),
peerDead: make(chan peer.ID),
cancelCh: make(chan *Subscription),
......@@ -320,7 +321,7 @@ func (p *PubSub) processLoop(ctx context.Context) {
close(ch)
if p.host.Network().Connectedness(pid) == inet.Connected {
if p.host.Network().Connectedness(pid) == network.Connected {
// still connected, must be a duplicate connection being closed.
// we respawn the writer as we need to ensure there is a stream active
log.Warning("peer declared dead but still connected; respawning writer: ", pid)
......
......@@ -5,9 +5,9 @@ import (
pb "github.com/libp2p/go-libp2p-pubsub/pb"
host "github.com/libp2p/go-libp2p-host"
peer "github.com/libp2p/go-libp2p-peer"
protocol "github.com/libp2p/go-libp2p-protocol"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
)
const (
......
......@@ -5,8 +5,8 @@ import (
pb "github.com/libp2p/go-libp2p-pubsub/pb"
crypto "github.com/libp2p/go-libp2p-crypto"
peer "github.com/libp2p/go-libp2p-peer"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer"
)
const SignPrefix = "libp2p-pubsub:"
......
......@@ -5,8 +5,8 @@ import (
pb "github.com/libp2p/go-libp2p-pubsub/pb"
crypto "github.com/libp2p/go-libp2p-crypto"
peer "github.com/libp2p/go-libp2p-peer"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer"
)
func TestSigning(t *testing.T) {
......
......@@ -6,7 +6,7 @@ import (
"runtime"
"time"
peer "github.com/libp2p/go-libp2p-peer"
"github.com/libp2p/go-libp2p-core/peer"
)
const (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment