mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-05-18 04:39:29 +00:00
Add master and portoffset option
This commit is contained in:
parent
438f2ecab2
commit
11575f5df3
@ -12,10 +12,12 @@ import strutils except fromHex
|
|||||||
const
|
const
|
||||||
defaults ="--log-level:DEBUG --log-metrics --metrics-server --rpc"
|
defaults ="--log-level:DEBUG --log-metrics --metrics-server --rpc"
|
||||||
wakuNodeBin = "build" / "wakunode"
|
wakuNodeBin = "build" / "wakunode"
|
||||||
|
portOffset = 2
|
||||||
|
|
||||||
type
|
type
|
||||||
NodeInfo* = object
|
NodeInfo* = object
|
||||||
cmd: string
|
cmd: string
|
||||||
|
master: bool
|
||||||
address: string
|
address: string
|
||||||
shift: int
|
shift: int
|
||||||
label: string
|
label: string
|
||||||
@ -25,7 +27,7 @@ type
|
|||||||
# TODO: Create Node command, something like this:
|
# TODO: Create Node command, something like this:
|
||||||
# "build/wakunode --log-level:DEBUG --log-metrics --metrics-server --rpc --waku-topic-interest:false --nodekey:e685079b7fa34dd35d3ffb2e40ab970360e94aa7dcc1262d36a8e2320a2c08ce --ports-shift:2 --discovery:off "
|
# "build/wakunode --log-level:DEBUG --log-metrics --metrics-server --rpc --waku-topic-interest:false --nodekey:e685079b7fa34dd35d3ffb2e40ab970360e94aa7dcc1262d36a8e2320a2c08ce --ports-shift:2 --discovery:off "
|
||||||
# Ok cool so it is config.nim parseCmdArg, then use fromHex
|
# Ok cool so it is config.nim parseCmdArg, then use fromHex
|
||||||
proc initNodeCmd(shift: int, staticNodes: seq[string] = @[], label: string): NodeInfo =
|
proc initNodeCmd(shift: int, staticNodes: seq[string] = @[], master = false, label: string): NodeInfo =
|
||||||
let
|
let
|
||||||
key = SkPrivateKey.random()
|
key = SkPrivateKey.random()
|
||||||
hkey = key.getBytes().toHex()
|
hkey = key.getBytes().toHex()
|
||||||
@ -52,13 +54,14 @@ proc initNodeCmd(shift: int, staticNodes: seq[string] = @[], label: string): Nod
|
|||||||
result.cmd &= "--staticnode:" & staticNode & " "
|
result.cmd &= "--staticnode:" & staticNode & " "
|
||||||
result.shift = shift
|
result.shift = shift
|
||||||
result.label = label
|
result.label = label
|
||||||
|
result.master = master
|
||||||
result.address = listenStr
|
result.address = listenStr
|
||||||
|
|
||||||
info "Node command created.", cmd=result.cmd, address = result.address
|
info "Node command created.", cmd=result.cmd, address = result.address
|
||||||
|
|
||||||
# TODO: Setup diff topology, star, mesh, etc
|
# TODO: Setup diff topology, star, mesh, etc
|
||||||
let masterNode = initNodeCmd(0, @[], "master node")
|
let masterNode = initNodeCmd(portOffset, @[], "master node")
|
||||||
let otherNode = initNodeCmd(0, @[masterNode.address], "other node")
|
let otherNode = initNodeCmd(portOFfset + 1, @[masterNode.address], "other node")
|
||||||
|
|
||||||
echo masterNode
|
echo masterNode
|
||||||
echo "---"
|
echo "---"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user