Basic waku protocol stub floodsub

This commit is contained in:
Oskar Thoren 2020-05-01 13:00:00 +08:00
parent e227959a34
commit 57953b57bf
No known key found for this signature in database
GPG Key ID: B2ECCFD3BC2EF77E
2 changed files with 36 additions and 1 deletions

View File

@ -14,3 +14,6 @@ wakunode2: node/v2/wakunode.nim
quicksim2: node/v2/quicksim.nim quicksim2: node/v2/quicksim.nim
nim c --threads:on -o:build/quicksim2 node/v2/quicksim.nim nim c --threads:on -o:build/quicksim2 node/v2/quicksim.nim
protocol2: protocol/v2/waku_protocol.nim
nim c --threads:on -o:build/protocol2 protocol/v2/waku_protocol.nim

View File

@ -3,4 +3,36 @@
## This file should eventually correspond to waku_protocol as RLPx subprotocol. ## This file should eventually correspond to waku_protocol as RLPx subprotocol.
## Instead, it should likely be on top of GossipSub with a similar interface. ## Instead, it should likely be on top of GossipSub with a similar interface.
const wakuVersionStr = "2.0.0-alpha1" import sequtils, tables, options, sets, strutils
import chronos, chronicles
import ../../vendor/nim-libp2p/libp2p/protocols/pubsub/pubsub,
../../vendor/nim-libp2p/libp2p/protocols/pubsub/pubsubpeer,
../../vendor/nim-libp2p/libp2p/protocols/pubsub/floodsub
logScope:
topic = "WakuSub"
# For spike
const WakuSubCodec* = "/WakuSub/0.0.1"
#const wakuVersionStr = "2.0.0-alpha1"
# So this should already have floodsub table, seen, as well as peerinfo, topics, peers, etc
# How do we verify that in nim?
type
WakuSub* = ref object of FloodSub
# XXX: just playing
text*: string
# method subscribeTopic
# method handleDisconnect
# method rpcHandler
# method init
# method publish
# method unsubscribe
# method initPubSub
# To defer to parent object something like:
# procCall PubSub(f).publish(topic, data)
# Then we should be able to write tests like floodsub test