refactor: remove go-wakurelay-pubsub and update dependencies

This commit is contained in:
Richard Ramos 2021-10-08 09:50:56 -04:00
parent dbd7a1c2d7
commit 4a7779dda1
12 changed files with 1531 additions and 472 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,10 +9,10 @@ require (
github.com/gdamore/tcell/v2 v2.2.0
github.com/golang/protobuf v1.5.2
github.com/ipfs/go-log v1.0.5
github.com/libp2p/go-libp2p-core v0.8.6
github.com/multiformats/go-multiaddr v0.3.1
github.com/libp2p/go-libp2p-core v0.9.0
github.com/multiformats/go-multiaddr v0.4.0
github.com/rivo/tview v0.0.0-20210312174852-ae9464cc3598
github.com/status-im/go-waku v0.0.0-20210428201044-3d8aae5b81b9
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
google.golang.org/protobuf v1.26.0
golang.org/x/crypto v0.0.0-20210813211128-0a44fdfbc16e
google.golang.org/protobuf v1.27.1
)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

17
go.mod
View File

@ -10,23 +10,20 @@ require (
github.com/ethereum/go-ethereum v1.10.4
github.com/golang/protobuf v1.5.2
github.com/ipfs/go-ds-sql v0.2.0
github.com/ipfs/go-log v1.0.4
github.com/ipfs/go-log v1.0.5
github.com/jessevdk/go-flags v1.4.0
github.com/libp2p/go-libp2p v0.13.0
github.com/libp2p/go-libp2p v0.15.1
github.com/libp2p/go-libp2p-connmgr v0.2.4
github.com/libp2p/go-libp2p-core v0.8.5
github.com/libp2p/go-libp2p-peerstore v0.2.6
github.com/libp2p/go-libp2p-core v0.9.0
github.com/libp2p/go-libp2p-peerstore v0.3.0
github.com/libp2p/go-libp2p-pubsub v0.5.5
github.com/libp2p/go-msgio v0.0.6
github.com/mattn/go-sqlite3 v1.14.6
github.com/minio/sha256-simd v0.1.1
github.com/multiformats/go-multiaddr v0.3.1
github.com/multiformats/go-multiaddr-net v0.2.0
github.com/prometheus/common v0.29.0 // indirect
github.com/minio/sha256-simd v1.0.0
github.com/multiformats/go-multiaddr v0.4.0
github.com/prometheus/statsd_exporter v0.21.0 // indirect
github.com/status-im/go-waku-rendezvous v0.0.0-20211005020656-b53661c58574
github.com/status-im/go-wakurelay-pubsub v0.4.3-0.20211006151908-91851dda6375
github.com/stretchr/testify v1.7.0
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954
go.opencensus.io v0.23.0
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
)

392
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@ import (
"github.com/libp2p/go-libp2p-core/protocol"
"github.com/libp2p/go-libp2p-peerstore/pstoreds"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/multiformats/go-multiaddr"
rendezvous "github.com/status-im/go-waku-rendezvous"
"github.com/status-im/go-waku/waku/metrics"
@ -36,7 +37,6 @@ import (
"github.com/status-im/go-waku/waku/v2/protocol/lightpush"
"github.com/status-im/go-waku/waku/v2/protocol/relay"
"github.com/status-im/go-waku/waku/v2/protocol/store"
pubsub "github.com/status-im/go-wakurelay-pubsub"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/opt"
)

View File

@ -9,8 +9,8 @@ import (
ma "github.com/multiformats/go-multiaddr"
"github.com/status-im/go-waku/waku/v2/protocol/filter"
"github.com/status-im/go-waku/waku/v2/protocol/lightpush"
"github.com/status-im/go-waku/waku/v2/protocol/relay"
"github.com/status-im/go-waku/waku/v2/protocol/store"
wakurelay "github.com/status-im/go-wakurelay-pubsub"
)
// A map of peer IDs to supported protocols
@ -102,7 +102,7 @@ func (w *WakuNode) Status() (isOnline bool, hasHistory bool) {
}
for _, protocol := range protocols {
if !hasRelay && protocol == string(wakurelay.WakuRelayID_v200) {
if !hasRelay && protocol == string(relay.WakuRelayID_v200) {
hasRelay = true
}
if !hasLightPush && protocol == string(lightpush.LightPushID_v20beta1) {

View File

@ -16,7 +16,6 @@ import (
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peerstore"
p2pproto "github.com/libp2p/go-libp2p-core/protocol"
peerstore "github.com/libp2p/go-libp2p-peerstore"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/p2p/protocol/ping"
ma "github.com/multiformats/go-multiaddr"
@ -147,7 +146,7 @@ func (w *WakuNode) Start() error {
if w.opts.enableRendezvous {
rendezvous := rendezvous.NewRendezvousDiscovery(w.host)
w.opts.wOpts = append(w.opts.wOpts, wakurelay.WithDiscovery(rendezvous, w.opts.rendezvousOpts...))
w.opts.wOpts = append(w.opts.wOpts, pubsub.WithDiscovery(rendezvous, w.opts.rendezvousOpts...))
}
err := w.mountRelay(w.opts.enableRelay, w.opts.wOpts...)
@ -203,49 +202,6 @@ func (w *WakuNode) ID() string {
return w.host.ID().Pretty()
}
func (w *WakuNode) GetPeerStats() PeerStats {
return w.peers
}
func (w *WakuNode) IsOnline() bool {
hasRelay := false
hasLightPush := false
hasStore := false
hasFilter := false
for _, v := range w.peers {
for _, protocol := range v {
if !hasRelay && protocol == string(relay.WakuRelayID_v200) {
hasRelay = true
}
if !hasLightPush && protocol == string(lightpush.WakuLightPushProtocolId) {
hasLightPush = true
}
if !hasStore && protocol == string(store.WakuStoreProtocolId) {
hasStore = true
}
if !hasFilter && protocol == string(filter.WakuFilterProtocolId) {
hasFilter = true
}
if hasRelay || hasLightPush && (hasStore || hasFilter) {
return true
}
}
}
return false
}
func (w *WakuNode) HasHistory() bool {
for _, v := range w.peers {
for _, protocol := range v {
if protocol == string(store.WakuStoreProtocolId) {
return true
}
}
}
return false
}
func (w *WakuNode) ListenAddresses() []ma.Multiaddr {
hostInfo, _ := ma.NewMultiaddr(fmt.Sprintf("/p2p/%s", w.host.ID().Pretty()))
var result []ma.Multiaddr

View File

@ -10,7 +10,7 @@ import (
"github.com/libp2p/go-libp2p-core/crypto"
pubsub "github.com/libp2p/go-libp2p-pubsub"
ma "github.com/multiformats/go-multiaddr"
manet "github.com/multiformats/go-multiaddr-net"
manet "github.com/multiformats/go-multiaddr/net"
rendezvous "github.com/status-im/go-waku-rendezvous"
"github.com/status-im/go-waku/waku/v2/protocol/store"
)
@ -36,7 +36,7 @@ type WakuNodeParameters struct {
enableRendezvous bool
enableRendezvousServer bool
rendevousStorage rendezvous.Storage
rendezvousOpts []wakurelay.DiscoverOpt
rendezvousOpts []pubsub.DiscoverOpt
keepAliveInterval time.Duration

View File

@ -54,16 +54,16 @@ func NewWakuRelay(ctx context.Context, h host.Host, opts ...pubsub.Option) (*Wak
opts = append(opts, pubsub.WithGossipSubProtocols(
[]protocol.ID{pubsub.GossipSubID_v11, pubsub.GossipSubID_v10, pubsub.FloodSubID, WakuRelayID_v200},
func (feat GossipSubFeature, proto protocol.ID) bool {
func(feat pubsub.GossipSubFeature, proto protocol.ID) bool {
switch feat {
case GossipSubFeatureMesh:
return proto == GossipSubID_v11 || proto == GossipSubID_v10
case GossipSubFeaturePX:
return proto == GossipSubID_v11
case pubsub.GossipSubFeatureMesh:
return proto == pubsub.GossipSubID_v11 || proto == pubsub.GossipSubID_v10
case pubsub.GossipSubFeaturePX:
return proto == pubsub.GossipSubID_v11
default:
return false
}
}
},
))
ps, err := pubsub.NewGossipSub(ctx, h, opts...)