conditional enable gossip11 module

This commit is contained in:
Giovanni Petrantoni 2020-07-04 11:58:35 +09:00
parent be0375f840
commit 028b390c7f
4 changed files with 20 additions and 4 deletions

View File

@ -9,9 +9,14 @@ import
crypto/crypto, transports/[transport, tcptransport],
muxers/[muxer, mplex/mplex, mplex/types],
protocols/[identify, secure/secure],
protocols/pubsub/[pubsub, gossipsub, floodsub],
protocols/pubsub/[pubsub, floodsub],
protocols/pubsub/rpc/message
when not defined(gossip11):
import protocols/pubsub/gossipsub
else:
import protocols/pubsub/gossipsub11
import
protocols/secure/noise,
protocols/secure/secio

View File

@ -1,4 +1,7 @@
include ../../libp2p/protocols/pubsub/gossipsub
when not defined(gossip11):
include ../../libp2p/protocols/pubsub/gossipsub
else:
include ../../libp2p/protocols/pubsub/gossipsub11
{.used.}

View File

@ -19,9 +19,13 @@ import utils, ../../libp2p/[errors,
crypto/crypto,
stream/bufferstream,
protocols/pubsub/pubsub,
protocols/pubsub/gossipsub,
protocols/pubsub/rpc/messages]
when not defined(gossip11):
import ../../libp2p/protocols/pubsub/gossipsub
else:
import ../../libp2p/protocols/pubsub/gossipsub11
import ../helpers
proc waitSub(sender, receiver: auto; key: string) {.async, gcsafe.} =

View File

@ -26,9 +26,13 @@ import ../libp2p/[daemon/daemonapi,
transports/tcptransport,
protocols/secure/secure,
protocols/pubsub/pubsub,
protocols/pubsub/gossipsub,
protocols/pubsub/floodsub]
when not defined(gossip11):
import ../libp2p/protocols/pubsub/gossipsub
else:
import ../libp2p/protocols/pubsub/gossipsub11
type
# TODO: Unify both PeerInfo structs
NativePeerInfo = peerinfo.PeerInfo