Add empty talkreq command to dcli

This commit is contained in:
kdeme 2020-11-13 12:45:39 +01:00
parent 784a868705
commit 18430ef127
No known key found for this signature in database
GPG Key ID: 4E8DD21420AF43F5
1 changed files with 12 additions and 0 deletions

View File

@ -9,6 +9,7 @@ type
noCommand noCommand
ping ping
findnode findnode
talkreq
DiscoveryConf* = object DiscoveryConf* = object
logLevel* {. logLevel* {.
@ -71,6 +72,11 @@ type
argument argument
desc: "ENR URI of the node to send a findNode message" desc: "ENR URI of the node to send a findNode message"
name: "node" .}: Node name: "node" .}: Node
of talkreq:
talkreqTarget* {.
argument
desc: "ENR URI of the node to send a talkreq message"
name: "node" .}: Node
proc parseCmdArg*(T: type enr.Record, p: TaintedString): T = proc parseCmdArg*(T: type enr.Record, p: TaintedString): T =
if not fromURI(result, p): if not fromURI(result, p):
@ -173,6 +179,12 @@ proc run(config: DiscoveryConf) =
echo $node.record & " - " & shortLog(node) echo $node.record & " - " & shortLog(node)
else: else:
echo "No Nodes message returned" echo "No Nodes message returned"
of talkreq:
let talkresp = waitFor d.talkreq(config.talkreqTarget, @[], @[])
if talkresp.isOk():
echo talkresp[]
else:
echo "No Talk Response message returned"
of noCommand: of noCommand:
d.start() d.start()
runForever() runForever()