Cleanup the wakunode2 config (#242)

This commit is contained in:
Kim De Mey 2020-10-22 17:04:17 +02:00 committed by GitHub
parent bfb29338a1
commit aab93912ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 72 deletions

View File

@ -32,10 +32,10 @@ To just run a node and not interact on the chat it is enough to run `wakunode2`:
./build/wakunode2 --staticnode:<multiaddr>
```
You can also run the `wakubridge` process, which currently runs both a Waku v1
and Waku v2 node. Currently, it has the same effect as running a `wakunode` and
`wakunode2` process separately, but bridging functionality will be added later
to this application.
You can also run the `wakubridge` process, which runs both a Waku v1 and Waku v2
node. Currently, it has the same effect as running a `wakunode` and `wakunode2`
process separately, but bridging functionality will be added later to this
application.
```
./build/wakubridge --staticnodev2:<multiaddr> --fleetv1:test

View File

@ -21,7 +21,7 @@ proc runBackground() {.async.} =
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
Port(uint16(conf.tcpPort) + conf.portsShift),
Port(uint16(conf.udpPort) + conf.portsShift))
node = WakuNode.init(conf.nodeKey, conf.libp2pAddress,
node = WakuNode.init(conf.nodeKey, conf.listenAddress,
Port(uint16(conf.tcpPort) + conf.portsShift), extIp, extTcpPort)
await node.start()

View File

@ -153,7 +153,7 @@ proc processInput(rfd: AsyncFD, rng: ref BrHmacDrbgContext) {.async.} =
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
Port(uint16(conf.tcpPort) + conf.portsShift),
Port(uint16(conf.udpPort) + conf.portsShift))
node = WakuNode.init(conf.nodeKey, conf.libp2pAddress,
node = WakuNode.init(conf.nodeKey, conf.listenAddress,
Port(uint16(conf.tcpPort) + conf.portsShift), extIp, extTcpPort)
# waitFor vs await

View File

@ -8,19 +8,13 @@ import
eth/keys
type
Fleet* = enum
none
prod
staging
test
WakuNodeConf* = object
logLevel* {.
desc: "Sets the log level."
defaultValue: LogLevel.INFO
name: "log-level" }: LogLevel
libp2pAddress* {.
listenAddress* {.
defaultValue: defaultListenAddress(config)
desc: "Listening address for the LibP2P traffic."
name: "listen-address"}: ValidIpAddress
@ -45,25 +39,6 @@ type
"Must be one of: any, none, upnp, pmp, extip:<IP>."
defaultValue: "any" }: string
discovery* {.
desc: "Enable/disable discovery v4."
defaultValue: true
name: "discovery" }: bool
noListen* {.
desc: "Disable listening for incoming peers."
defaultValue: false
name: "no-listen" }: bool
fleet* {.
desc: "Select the fleet to connect to."
defaultValue: Fleet.none
name: "fleet" }: Fleet
bootnodes* {.
desc: "Enode URL to bootstrap P2P discovery with. Argument may be repeated."
name: "bootnode" }: seq[string]
staticnodes* {.
desc: "Enode URL to directly connect with. Argument may be repeated."
name: "staticnode" }: seq[string]
@ -93,42 +68,16 @@ type
defaultValue: ""
name: "filternode" }: string
whisper* {.
desc: "Enable the Whisper protocol."
defaultValue: false
name: "whisper" }: bool
whisperBridge* {.
desc: "Enable the Whisper protocol and bridge with Waku protocol."
defaultValue: false
name: "whisper-bridge" }: bool
lightNode* {.
desc: "Run as light node (no message relay).",
defaultValue: false
name: "light-node" }: bool
wakuTopicInterest* {.
desc: "Run as node with a topic-interest",
defaultValue: false
name: "waku-topic-interest" }: bool
wakuPow* {.
desc: "PoW requirement of Waku node.",
defaultValue: 0.002
name: "waku-pow" }: float64
topics* {.
desc: "Default topics to subscribe to (space seperated list)."
defaultValue: "waku"
name: "topics" .}: string
# NOTE: Signature is different here, we return PrivateKey and not KeyPair
nodekey* {.
desc: "P2P node private key as hex.",
defaultValue: crypto.PrivateKey.random(Secp256k1, keys.newRng()[]).tryGet()
name: "nodekey" }: crypto.PrivateKey
# TODO: Add nodekey file option
bootnodeOnly* {.
desc: "Run only as discovery bootnode."
defaultValue: false
name: "bootnode-only" }: bool
rpc* {.
desc: "Enable Waku RPC server.",
@ -164,15 +113,6 @@ type
desc: "Enable metrics logging."
defaultValue: false
name: "log-metrics" }: bool
topics* {.
desc: "Default topics to subscribe to (space seperated list)."
defaultValue: "waku"
name: "topics" .}: string
# TODO:
# - discv5 + topic register
# - mailserver functionality
# NOTE: Keys are different in nim-libp2p
proc parseCmdArg*(T: type crypto.PrivateKey, p: TaintedString): T =

View File

@ -324,7 +324,7 @@ when isMainModule:
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
Port(uint16(conf.tcpPort) + conf.portsShift),
Port(uint16(conf.udpPort) + conf.portsShift))
node = WakuNode.init(conf.nodeKey, conf.libp2pAddress,
node = WakuNode.init(conf.nodeKey, conf.listenAddress,
Port(uint16(conf.tcpPort) + conf.portsShift), extIp, extTcpPort)
waitFor node.start()