mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-07 16:33:08 +00:00
Cleanup the wakunode2 config (#242)
This commit is contained in:
parent
bfb29338a1
commit
aab93912ef
@ -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>
|
./build/wakunode2 --staticnode:<multiaddr>
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also run the `wakubridge` process, which currently runs both a Waku v1
|
You can also run the `wakubridge` process, which runs both a Waku v1 and Waku v2
|
||||||
and Waku v2 node. Currently, it has the same effect as running a `wakunode` and
|
node. Currently, it has the same effect as running a `wakunode` and `wakunode2`
|
||||||
`wakunode2` process separately, but bridging functionality will be added later
|
process separately, but bridging functionality will be added later to this
|
||||||
to this application.
|
application.
|
||||||
|
|
||||||
```
|
```
|
||||||
./build/wakubridge --staticnodev2:<multiaddr> --fleetv1:test
|
./build/wakubridge --staticnodev2:<multiaddr> --fleetv1:test
|
||||||
|
|||||||
@ -21,7 +21,7 @@ proc runBackground() {.async.} =
|
|||||||
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
|
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
|
||||||
Port(uint16(conf.tcpPort) + conf.portsShift),
|
Port(uint16(conf.tcpPort) + conf.portsShift),
|
||||||
Port(uint16(conf.udpPort) + 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)
|
Port(uint16(conf.tcpPort) + conf.portsShift), extIp, extTcpPort)
|
||||||
|
|
||||||
await node.start()
|
await node.start()
|
||||||
|
|||||||
@ -153,7 +153,7 @@ proc processInput(rfd: AsyncFD, rng: ref BrHmacDrbgContext) {.async.} =
|
|||||||
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
|
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
|
||||||
Port(uint16(conf.tcpPort) + conf.portsShift),
|
Port(uint16(conf.tcpPort) + conf.portsShift),
|
||||||
Port(uint16(conf.udpPort) + 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)
|
Port(uint16(conf.tcpPort) + conf.portsShift), extIp, extTcpPort)
|
||||||
|
|
||||||
# waitFor vs await
|
# waitFor vs await
|
||||||
|
|||||||
@ -8,19 +8,13 @@ import
|
|||||||
eth/keys
|
eth/keys
|
||||||
|
|
||||||
type
|
type
|
||||||
Fleet* = enum
|
|
||||||
none
|
|
||||||
prod
|
|
||||||
staging
|
|
||||||
test
|
|
||||||
|
|
||||||
WakuNodeConf* = object
|
WakuNodeConf* = object
|
||||||
logLevel* {.
|
logLevel* {.
|
||||||
desc: "Sets the log level."
|
desc: "Sets the log level."
|
||||||
defaultValue: LogLevel.INFO
|
defaultValue: LogLevel.INFO
|
||||||
name: "log-level" }: LogLevel
|
name: "log-level" }: LogLevel
|
||||||
|
|
||||||
libp2pAddress* {.
|
listenAddress* {.
|
||||||
defaultValue: defaultListenAddress(config)
|
defaultValue: defaultListenAddress(config)
|
||||||
desc: "Listening address for the LibP2P traffic."
|
desc: "Listening address for the LibP2P traffic."
|
||||||
name: "listen-address"}: ValidIpAddress
|
name: "listen-address"}: ValidIpAddress
|
||||||
@ -45,25 +39,6 @@ type
|
|||||||
"Must be one of: any, none, upnp, pmp, extip:<IP>."
|
"Must be one of: any, none, upnp, pmp, extip:<IP>."
|
||||||
defaultValue: "any" }: string
|
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* {.
|
staticnodes* {.
|
||||||
desc: "Enode URL to directly connect with. Argument may be repeated."
|
desc: "Enode URL to directly connect with. Argument may be repeated."
|
||||||
name: "staticnode" }: seq[string]
|
name: "staticnode" }: seq[string]
|
||||||
@ -93,42 +68,16 @@ type
|
|||||||
defaultValue: ""
|
defaultValue: ""
|
||||||
name: "filternode" }: string
|
name: "filternode" }: string
|
||||||
|
|
||||||
whisper* {.
|
topics* {.
|
||||||
desc: "Enable the Whisper protocol."
|
desc: "Default topics to subscribe to (space seperated list)."
|
||||||
defaultValue: false
|
defaultValue: "waku"
|
||||||
name: "whisper" }: bool
|
name: "topics" .}: string
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
# NOTE: Signature is different here, we return PrivateKey and not KeyPair
|
# NOTE: Signature is different here, we return PrivateKey and not KeyPair
|
||||||
nodekey* {.
|
nodekey* {.
|
||||||
desc: "P2P node private key as hex.",
|
desc: "P2P node private key as hex.",
|
||||||
defaultValue: crypto.PrivateKey.random(Secp256k1, keys.newRng()[]).tryGet()
|
defaultValue: crypto.PrivateKey.random(Secp256k1, keys.newRng()[]).tryGet()
|
||||||
name: "nodekey" }: crypto.PrivateKey
|
name: "nodekey" }: crypto.PrivateKey
|
||||||
# TODO: Add nodekey file option
|
|
||||||
|
|
||||||
bootnodeOnly* {.
|
|
||||||
desc: "Run only as discovery bootnode."
|
|
||||||
defaultValue: false
|
|
||||||
name: "bootnode-only" }: bool
|
|
||||||
|
|
||||||
rpc* {.
|
rpc* {.
|
||||||
desc: "Enable Waku RPC server.",
|
desc: "Enable Waku RPC server.",
|
||||||
@ -164,15 +113,6 @@ type
|
|||||||
desc: "Enable metrics logging."
|
desc: "Enable metrics logging."
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
name: "log-metrics" }: bool
|
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
|
# NOTE: Keys are different in nim-libp2p
|
||||||
proc parseCmdArg*(T: type crypto.PrivateKey, p: TaintedString): T =
|
proc parseCmdArg*(T: type crypto.PrivateKey, p: TaintedString): T =
|
||||||
|
|||||||
@ -324,7 +324,7 @@ when isMainModule:
|
|||||||
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
|
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
|
||||||
Port(uint16(conf.tcpPort) + conf.portsShift),
|
Port(uint16(conf.tcpPort) + conf.portsShift),
|
||||||
Port(uint16(conf.udpPort) + 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)
|
Port(uint16(conf.tcpPort) + conf.portsShift), extIp, extTcpPort)
|
||||||
|
|
||||||
waitFor node.start()
|
waitFor node.start()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user