mirror of https://github.com/waku-org/nwaku.git
chore: move apps and tools to their own directory
This commit is contained in:
parent
a2a5a6ef01
commit
5fbc537cbf
|
@ -21,16 +21,17 @@ import libp2p/[switch, # manage transports, a single entry poi
|
||||||
protocols/secure/secio, # define the protocol of secure input / output, allows encrypted communication that uses public keys to validate signed messages instead of a certificate authority like in TLS
|
protocols/secure/secio, # define the protocol of secure input / output, allows encrypted communication that uses public keys to validate signed messages instead of a certificate authority like in TLS
|
||||||
nameresolving/dnsresolver,# define DNS resolution
|
nameresolving/dnsresolver,# define DNS resolution
|
||||||
muxers/muxer] # define an interface for stream multiplexing, allowing peers to offer many protocols over a single connection
|
muxers/muxer] # define an interface for stream multiplexing, allowing peers to offer many protocols over a single connection
|
||||||
import ../../waku/v2/protocol/waku_message,
|
import
|
||||||
../../waku/v2/protocol/waku_lightpush,
|
../../waku/v2/protocol/waku_message,
|
||||||
../../waku/v2/protocol/waku_filter,
|
../../waku/v2/protocol/waku_lightpush,
|
||||||
../../waku/v2/protocol/waku_store,
|
../../waku/v2/protocol/waku_filter,
|
||||||
../../waku/v2/node/[wakunode2, waku_payload],
|
../../waku/v2/protocol/waku_store,
|
||||||
../../waku/v2/node/dnsdisc/waku_dnsdisc,
|
../../waku/v2/node/[wakunode2, waku_payload],
|
||||||
../../waku/v2/node/peer_manager/peer_manager,
|
../../waku/v2/node/dnsdisc/waku_dnsdisc,
|
||||||
../../waku/v2/utils/[peers, time],
|
../../waku/v2/node/peer_manager/peer_manager,
|
||||||
../../waku/common/utils/nat,
|
../../waku/v2/utils/[peers, time],
|
||||||
./config_chat2
|
../../waku/common/utils/nat,
|
||||||
|
./config_chat2
|
||||||
|
|
||||||
when defined(rln) or defined(rlnzerokit):
|
when defined(rln) or defined(rlnzerokit):
|
||||||
import
|
import
|
|
@ -5,8 +5,9 @@ import
|
||||||
libp2p/crypto/crypto,
|
libp2p/crypto/crypto,
|
||||||
libp2p/crypto/secp,
|
libp2p/crypto/secp,
|
||||||
nimcrypto/utils,
|
nimcrypto/utils,
|
||||||
eth/keys,
|
eth/keys
|
||||||
../../waku/v2/protocol/waku_message
|
import
|
||||||
|
../../../waku/v2/protocol/waku_message
|
||||||
|
|
||||||
type
|
type
|
||||||
Fleet* = enum
|
Fleet* = enum
|
|
@ -7,14 +7,14 @@ import
|
||||||
stew/[byteutils, endians2],
|
stew/[byteutils, endians2],
|
||||||
stew/shims/net as stewNet, json_rpc/rpcserver,
|
stew/shims/net as stewNet, json_rpc/rpcserver,
|
||||||
# Matterbridge client imports
|
# Matterbridge client imports
|
||||||
../../../waku/common/utils/matterbridge_client,
|
../../waku/common/utils/matterbridge_client,
|
||||||
# Waku v2 imports
|
# Waku v2 imports
|
||||||
libp2p/crypto/crypto,
|
libp2p/crypto/crypto,
|
||||||
libp2p/errors,
|
libp2p/errors,
|
||||||
../../../waku/v2/protocol/waku_message,
|
../../../waku/v2/protocol/waku_message,
|
||||||
../../../waku/v2/node/wakunode2,
|
../../../waku/v2/node/wakunode2,
|
||||||
# Chat 2 imports
|
# Chat 2 imports
|
||||||
../chat2,
|
../chat2/chat2,
|
||||||
# Common cli config
|
# Common cli config
|
||||||
./config_chat2bridge
|
./config_chat2bridge
|
||||||
|
|
|
@ -12,15 +12,15 @@ import
|
||||||
eth/[keys, p2p], eth/common/utils,
|
eth/[keys, p2p], eth/common/utils,
|
||||||
eth/p2p/[enode, peer_pool],
|
eth/p2p/[enode, peer_pool],
|
||||||
eth/p2p/discoveryv5/random2,
|
eth/p2p/discoveryv5/random2,
|
||||||
../v1/protocol/waku_protocol,
|
../../waku/v1/protocol/waku_protocol,
|
||||||
# Waku v2 imports
|
# Waku v2 imports
|
||||||
libp2p/crypto/crypto,
|
libp2p/crypto/crypto,
|
||||||
libp2p/nameresolving/nameresolver,
|
libp2p/nameresolving/nameresolver,
|
||||||
../v2/utils/namespacing,
|
../../waku/v2/utils/namespacing,
|
||||||
../v2/utils/time,
|
../../waku/v2/utils/time,
|
||||||
../v2/protocol/waku_message,
|
../../waku/v2/protocol/waku_message,
|
||||||
../v2/node/wakunode2,
|
../../waku/v2/node/wakunode2,
|
||||||
../v2/node/peer_manager/peer_manager,
|
../../waku/v2/node/peer_manager/peer_manager,
|
||||||
# Common cli config
|
# Common cli config
|
||||||
./config_bridge
|
./config_bridge
|
||||||
|
|
||||||
|
@ -322,15 +322,15 @@ proc stop*(bridge: WakuBridge) {.async.} =
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
import
|
import
|
||||||
libp2p/nameresolving/dnsresolver,
|
libp2p/nameresolving/dnsresolver,
|
||||||
./utils/nat,
|
../../waku/common/utils/nat,
|
||||||
../whisper/whispernodes,
|
../../waku/whisper/whispernodes,
|
||||||
../v1/node/rpc/wakusim,
|
../../waku/v1/node/rpc/wakusim,
|
||||||
../v1/node/rpc/waku,
|
../../waku/v1/node/rpc/waku,
|
||||||
../v1/node/rpc/key_storage,
|
../../waku/v1/node/rpc/key_storage,
|
||||||
../v2/node/jsonrpc/[debug_api,
|
../../waku/v2/node/jsonrpc/[debug_api,
|
||||||
filter_api,
|
filter_api,
|
||||||
relay_api,
|
relay_api,
|
||||||
store_api]
|
store_api]
|
||||||
|
|
||||||
proc startV2Rpc(node: WakuNode, rpcServer: RpcHttpServer, conf: WakuNodeConf) =
|
proc startV2Rpc(node: WakuNode, rpcServer: RpcHttpServer, conf: WakuNodeConf) =
|
||||||
installDebugApiHandlers(node, rpcServer)
|
installDebugApiHandlers(node, rpcServer)
|
|
@ -12,14 +12,13 @@ import
|
||||||
libp2p/protocols/pubsub/rpc/messages,
|
libp2p/protocols/pubsub/rpc/messages,
|
||||||
libp2p/protocols/pubsub/pubsub,
|
libp2p/protocols/pubsub/pubsub,
|
||||||
eth/p2p,
|
eth/p2p,
|
||||||
eth/keys,
|
eth/keys
|
||||||
../../waku/common/wakubridge,
|
import
|
||||||
../../waku/v1/protocol/waku_protocol,
|
../../waku/v1/protocol/waku_protocol,
|
||||||
../../waku/v2/protocol/waku_message,
|
../../waku/v2/protocol/waku_message,
|
||||||
../../waku/v2/protocol/waku_store,
|
|
||||||
../../waku/v2/protocol/waku_filter,
|
|
||||||
../../waku/v2/node/[wakunode2, waku_payload],
|
../../waku/v2/node/[wakunode2, waku_payload],
|
||||||
../../waku/v2/utils/peers,
|
../../waku/v2/utils/peers,
|
||||||
|
../../apps/wakubridge/wakubridge,
|
||||||
../test_helpers
|
../test_helpers
|
||||||
|
|
||||||
procSuite "WakuBridge":
|
procSuite "WakuBridge":
|
||||||
|
@ -139,12 +138,12 @@ procSuite "WakuBridge":
|
||||||
|
|
||||||
v2Node.subscribe(DefaultBridgeTopic, relayHandler)
|
v2Node.subscribe(DefaultBridgeTopic, relayHandler)
|
||||||
|
|
||||||
await sleepAsync(2000.millis)
|
await sleepAsync(250.millis)
|
||||||
|
|
||||||
# Test bridging from V2 to V1
|
# Test bridging from V2 to V1
|
||||||
await v2Node.publish(DefaultBridgeTopic, message)
|
await v2Node.publish(DefaultBridgeTopic, message)
|
||||||
|
|
||||||
await sleepAsync(2000.millis)
|
await sleepAsync(250.millis)
|
||||||
|
|
||||||
check:
|
check:
|
||||||
# v1Node received message published by v2Node
|
# v1Node received message published by v2Node
|
||||||
|
@ -173,7 +172,7 @@ procSuite "WakuBridge":
|
||||||
|
|
||||||
await v2Node.publish(DefaultBridgeTopic, message)
|
await v2Node.publish(DefaultBridgeTopic, message)
|
||||||
|
|
||||||
await sleepAsync(2000.millis)
|
await sleepAsync(250.millis)
|
||||||
|
|
||||||
check:
|
check:
|
||||||
# v1Node did not receive duplicate of previous message
|
# v1Node did not receive duplicate of previous message
|
||||||
|
@ -211,7 +210,7 @@ procSuite "WakuBridge":
|
||||||
|
|
||||||
# When
|
# When
|
||||||
waitFor v1Bridge.start()
|
waitFor v1Bridge.start()
|
||||||
await sleepAsync(2000.millis) # Give peers some time to connect
|
await sleepAsync(250.millis) # Give peers some time to connect
|
||||||
|
|
||||||
# Then
|
# Then
|
||||||
check:
|
check:
|
||||||
|
@ -228,7 +227,7 @@ procSuite "WakuBridge":
|
||||||
|
|
||||||
# When
|
# When
|
||||||
discard v1Bridge.maintenanceLoop() # Forces one more run of the maintenance loop
|
discard v1Bridge.maintenanceLoop() # Forces one more run of the maintenance loop
|
||||||
await sleepAsync(2000.millis) # Give peers some time to connect
|
await sleepAsync(250.millis) # Give peers some time to connect
|
||||||
|
|
||||||
# Then
|
# Then
|
||||||
check:
|
check:
|
||||||
|
|
|
@ -4,13 +4,14 @@ import
|
||||||
libp2p/[peerinfo, multiaddress],
|
libp2p/[peerinfo, multiaddress],
|
||||||
eth/common as eth_common, eth/keys,
|
eth/common as eth_common, eth/keys,
|
||||||
system,
|
system,
|
||||||
options,
|
options
|
||||||
../wakunode2,
|
import
|
||||||
../waku_payload,
|
../../waku/v2/node/wakunode2,
|
||||||
../jsonrpc/jsonrpc_types,
|
../../waku/v2/node/waku_payload,
|
||||||
../../protocol/waku_filter,
|
../../waku/v2/node/jsonrpc/jsonrpc_types,
|
||||||
../../protocol/waku_store,
|
../../waku/v2/protocol/waku_filter,
|
||||||
../../../v1/node/rpc/hexstrings
|
../../waku/v2/protocol/waku_store,
|
||||||
|
../../waku/v1/node/rpc/hexstrings
|
||||||
|
|
||||||
from strutils import rsplit
|
from strutils import rsplit
|
||||||
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
|
@ -4,13 +4,14 @@ import
|
||||||
libp2p/protobuf/minprotobuf,
|
libp2p/protobuf/minprotobuf,
|
||||||
eth/common as eth_common, eth/keys,
|
eth/common as eth_common, eth/keys,
|
||||||
system,
|
system,
|
||||||
options,
|
options
|
||||||
../wakunode2,
|
import
|
||||||
../waku_payload,
|
../../waku/v2/node/wakunode2,
|
||||||
../jsonrpc/jsonrpc_types,
|
../../waku/v2/node/waku_payload,
|
||||||
../../protocol/waku_filter,
|
../../waku/v2/node/jsonrpc/jsonrpc_types,
|
||||||
../../protocol/waku_store,
|
../../waku/v2/protocol/waku_filter,
|
||||||
../../../v1/node/rpc/hexstrings
|
../../waku/v2/protocol/waku_store,
|
||||||
|
../../waku/v1/node/rpc/hexstrings
|
||||||
|
|
||||||
from strutils import rsplit
|
from strutils import rsplit
|
||||||
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
|
@ -4,13 +4,15 @@ import
|
||||||
libp2p/[peerinfo, multiaddress],
|
libp2p/[peerinfo, multiaddress],
|
||||||
eth/common as eth_common, eth/keys,
|
eth/common as eth_common, eth/keys,
|
||||||
system,
|
system,
|
||||||
options,
|
options
|
||||||
../wakunode2,
|
import
|
||||||
../waku_payload,
|
../../waku/v2/node/wakunode2,
|
||||||
../jsonrpc/jsonrpc_types,
|
../../waku/v2/node/waku_payload,
|
||||||
../../protocol/waku_filter,
|
../../waku/v2/node/jsonrpc/jsonrpc_types,
|
||||||
../../protocol/waku_store,
|
../../waku/v2/protocol/waku_filter,
|
||||||
../../../v1/node/rpc/hexstrings
|
../../waku/v2/protocol/waku_store,
|
||||||
|
../../waku/v1/node/rpc/hexstrings
|
||||||
|
|
||||||
|
|
||||||
from strutils import rsplit
|
from strutils import rsplit
|
||||||
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
|
@ -3,13 +3,16 @@ import
|
||||||
libp2p/protobuf/minprotobuf,
|
libp2p/protobuf/minprotobuf,
|
||||||
eth/common as eth_common, eth/keys,
|
eth/common as eth_common, eth/keys,
|
||||||
system,
|
system,
|
||||||
options,
|
options
|
||||||
../wakunode2,
|
import
|
||||||
../waku_payload,
|
../../waku/v2/node/wakunode2,
|
||||||
../jsonrpc/jsonrpc_types,
|
../../waku/v2/node/waku_payload,
|
||||||
../../protocol/waku_filter,
|
../../waku/v2/node/jsonrpc/jsonrpc_types,
|
||||||
../../protocol/waku_store,
|
../../waku/v2/protocol/waku_filter,
|
||||||
../../../v1/node/rpc/hexstrings
|
../../waku/v2/protocol/waku_store,
|
||||||
|
../../waku/v1/node/rpc/hexstrings
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from strutils import rsplit
|
from strutils import rsplit
|
||||||
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
|
@ -4,13 +4,14 @@ import
|
||||||
libp2p/[peerinfo, multiaddress],
|
libp2p/[peerinfo, multiaddress],
|
||||||
eth/common as eth_common, eth/keys,
|
eth/common as eth_common, eth/keys,
|
||||||
system,
|
system,
|
||||||
options,
|
options
|
||||||
../wakunode2,
|
import
|
||||||
../waku_payload,
|
../../waku/v2/node/wakunode2,
|
||||||
../jsonrpc/jsonrpc_types,
|
../../waku/v2/node/waku_payload,
|
||||||
../../protocol/waku_filter,
|
../../waku/v2/node/jsonrpc/jsonrpc_types,
|
||||||
../../protocol/waku_store,
|
../../waku/v2/protocol/waku_filter,
|
||||||
../../../v1/node/rpc/hexstrings
|
../../waku/v2/protocol/waku_store,
|
||||||
|
../../waku/v1/node/rpc/hexstrings
|
||||||
|
|
||||||
from strutils import rsplit
|
from strutils import rsplit
|
||||||
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
|
@ -6,19 +6,19 @@ import
|
||||||
json_rpc/[rpcclient, rpcserver],
|
json_rpc/[rpcclient, rpcserver],
|
||||||
libp2p/protobuf/minprotobuf
|
libp2p/protobuf/minprotobuf
|
||||||
import
|
import
|
||||||
../protocol/waku_filter,
|
../../waku/v2/protocol/waku_filter,
|
||||||
../protocol/waku_store,
|
../../waku/v2/protocol/waku_store,
|
||||||
../protocol/waku_message,
|
../../waku/v2/protocol/waku_message,
|
||||||
../utils/time,
|
../../waku/v2/utils/time,
|
||||||
./wakunode2,
|
../../waku/v2/node/wakunode2,
|
||||||
./waku_payload,
|
../../waku/v2/node/waku_payload,
|
||||||
./jsonrpc/[jsonrpc_types,jsonrpc_utils]
|
../../waku/v2/node/jsonrpc/[jsonrpc_types,jsonrpc_utils]
|
||||||
|
|
||||||
|
|
||||||
from strutils import rsplit
|
from strutils import rsplit
|
||||||
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
||||||
|
|
||||||
const sigWakuPath = sourceDir / "jsonrpc" / "jsonrpc_callsigs.nim"
|
const sigWakuPath = sourceDir / ".." / ".." / "waku" / "v2" / "node" / "jsonrpc" / "jsonrpc_callsigs.nim"
|
||||||
createRpcSigs(RpcHttpClient, sigWakuPath)
|
createRpcSigs(RpcHttpClient, sigWakuPath)
|
||||||
|
|
||||||
const defaultTopic = "/waku/2/default-waku/proto"
|
const defaultTopic = "/waku/2/default-waku/proto"
|
40
waku.nimble
40
waku.nimble
|
@ -64,42 +64,46 @@ task test1, "Build & run Waku v1 tests":
|
||||||
|
|
||||||
### Waku v2 tasks
|
### Waku v2 tasks
|
||||||
task wakunode2, "Build Waku v2 (experimental) cli node":
|
task wakunode2, "Build Waku v2 (experimental) cli node":
|
||||||
buildBinary "wakunode2", "waku/v2/node/", "-d:chronicles_log_level=DEBUG"
|
let name = "wakunode2"
|
||||||
|
buildBinary name, "waku/v2/node/", "-d:chronicles_log_level=DEBUG"
|
||||||
|
|
||||||
|
task bridge, "Build Waku v1 - v2 bridge":
|
||||||
|
let name = "wakubridge"
|
||||||
|
buildBinary name, "apps/wakubridge/", "-d:chronicles_log_level=DEBUG"
|
||||||
|
|
||||||
|
task test2, "Build & run Waku v2 tests":
|
||||||
|
test "all_tests_v2"
|
||||||
|
|
||||||
|
|
||||||
task sim2, "Build Waku v2 simulation tools":
|
task sim2, "Build Waku v2 simulation tools":
|
||||||
buildBinary "quicksim2", "waku/v2/node/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "quicksim2", "tools/simulation/", "-d:chronicles_log_level=DEBUG"
|
||||||
buildBinary "start_network2", "waku/v2/node/", "-d:chronicles_log_level=TRACE"
|
buildBinary "start_network2", "tools/simulation/", "-d:chronicles_log_level=TRACE"
|
||||||
|
|
||||||
task example2, "Build Waku v2 example":
|
task example2, "Build Waku v2 example":
|
||||||
let name = "basic2"
|
let name = "basic2"
|
||||||
buildBinary name, "examples/v2/", "-d:chronicles_log_level=DEBUG"
|
buildBinary name, "examples/v2/", "-d:chronicles_log_level=DEBUG"
|
||||||
|
|
||||||
task test2, "Build & run Waku v2 tests":
|
|
||||||
test "all_tests_v2"
|
|
||||||
|
|
||||||
task scripts2, "Build Waku v2 scripts":
|
task scripts2, "Build Waku v2 scripts":
|
||||||
buildBinary "rpc_publish", "waku/v2/node/scripts/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "rpc_publish", "tools/scripts/", "-d:chronicles_log_level=DEBUG"
|
||||||
buildBinary "rpc_subscribe", "waku/v2/node/scripts/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "rpc_subscribe", "tools/scripts/", "-d:chronicles_log_level=DEBUG"
|
||||||
buildBinary "rpc_subscribe_filter", "waku/v2/node/scripts/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "rpc_subscribe_filter", "tools/scripts/", "-d:chronicles_log_level=DEBUG"
|
||||||
buildBinary "rpc_query", "waku/v2/node/scripts/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "rpc_query", "tools/scripts/", "-d:chronicles_log_level=DEBUG"
|
||||||
buildBinary "rpc_info", "waku/v2/node/scripts/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "rpc_info", "tools/scripts/", "-d:chronicles_log_level=DEBUG"
|
||||||
|
|
||||||
task chat2, "Build example Waku v2 chat usage":
|
task chat2, "Build example Waku v2 chat usage":
|
||||||
let name = "chat2"
|
|
||||||
# NOTE For debugging, set debug level. For chat usage we want minimal log
|
# NOTE For debugging, set debug level. For chat usage we want minimal log
|
||||||
# output to STDOUT. Can be fixed by redirecting logs to file (e.g.)
|
# output to STDOUT. Can be fixed by redirecting logs to file (e.g.)
|
||||||
#buildBinary name, "examples/v2/", "-d:chronicles_log_level=WARN"
|
#buildBinary name, "examples/v2/", "-d:chronicles_log_level=WARN"
|
||||||
buildBinary name, "examples/v2/", "-d:chronicles_log_level=DEBUG -d:chronicles_sinks=textlines[file] -d:ssl"
|
|
||||||
|
|
||||||
task bridge, "Build Waku v1 - v2 bridge":
|
let name = "chat2"
|
||||||
buildBinary "wakubridge", "waku/common/", "-d:chronicles_log_level=DEBUG"
|
buildBinary name, "apps/chat2/", "-d:chronicles_log_level=DEBUG -d:chronicles_sinks=textlines[file] -d:ssl"
|
||||||
|
|
||||||
task chat2bridge, "Build chat2-matterbridge":
|
task chat2bridge, "Build chat2bridge":
|
||||||
let name = "chat2bridge"
|
let name = "chat2bridge"
|
||||||
|
buildBinary name, "apps/chat2bridge/", "-d:chronicles_log_level=DEBUG"
|
||||||
|
|
||||||
buildBinary name, "examples/v2/matterbridge/", "-d:chronicles_log_level=DEBUG"
|
|
||||||
|
|
||||||
### Waku Tooling
|
### Waku Tooling
|
||||||
task wakucanary, "Build waku-canary tool":
|
task wakucanary, "Build waku-canary tool":
|
||||||
let name = "wakucanary"
|
let name = "wakucanary"
|
||||||
buildBinary name, "tools/wakucanary/", "-d:chronicles_log_level=DEBUG -d:chronicles_runtime_filtering:on"
|
buildBinary name, "tools/wakucanary/", "-d:chronicles_log_level=DEBUG -d:chronicles_runtime_filtering:on"
|
||||||
|
|
Binary file not shown.
|
@ -17,7 +17,7 @@ import
|
||||||
waku_rln_relay_metrics,
|
waku_rln_relay_metrics,
|
||||||
../../utils/time,
|
../../utils/time,
|
||||||
../../node/[wakunode2_types,config],
|
../../node/[wakunode2_types,config],
|
||||||
../../../../../examples/v2/config_chat2,
|
../../../../../apps/chat2/config_chat2,
|
||||||
../waku_message
|
../waku_message
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
|
|
Loading…
Reference in New Issue