mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-05-15 06:49:28 +00:00
* any port set to 0 on conf results in a random port bound * Debug API MyBoundPorts reports actually bound ports for all services, reports 0 if disabled * write back bound values to both WakuConf and WakuNode.ports * setupDiscoveryV5 returns Result and errors out on port 0 * rename setupAndStartDiscv5WithAutoPort to setupAndStartDiscv5 * updateWaku ENR rebuild now runs after discv5 startup * Add DefaultP2pTcpPort, DefaultDiscv5UdpPort, DefaultWebSocketPort, DefaultRestPort, DefaultMetricsHttpPort * add tests
21 lines
508 B
Nim
21 lines
508 B
Nim
{.push raises: [].}
|
|
|
|
import std/json
|
|
|
|
type BoundPorts* {.requiresInit.} = object
|
|
## Set by the factory once each service has bound to a port.
|
|
## A value of 0 means the service was not enabled or did not bind.
|
|
tcp*: uint16
|
|
webSocket*: uint16
|
|
rest*: uint16
|
|
discv5Udp*: uint16
|
|
metrics*: uint16
|
|
|
|
proc init*(T: type BoundPorts): BoundPorts =
|
|
return BoundPorts(
|
|
tcp: 0'u16, webSocket: 0'u16, rest: 0'u16, discv5Udp: 0'u16, metrics: 0'u16
|
|
)
|
|
|
|
proc `$`*(p: BoundPorts): string =
|
|
return $(%*p)
|