mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-17 10:21:21 +00:00
23 lines
674 B
Nim
23 lines
674 B
Nim
{.push raises: [].}
|
|
|
|
import std/[strutils, net]
|
|
import ../../../envvar_serialization
|
|
|
|
export net, envvar_serialization
|
|
|
|
proc readValue*(
|
|
r: var EnvvarReader, value: var IpAddress
|
|
) {.raises: [SerializationError].} =
|
|
try:
|
|
value = parseIpAddress(r.readValue(string))
|
|
except ValueError, IOError:
|
|
raise newException(
|
|
SerializationError, "Invalid IP address: " & getCurrentExceptionMsg()
|
|
)
|
|
|
|
proc readValue*(r: var EnvvarReader, value: var Port) {.raises: [SerializationError].} =
|
|
try:
|
|
value = parseUInt(r.readValue(string)).Port
|
|
except ValueError, IOError:
|
|
raise newException(SerializationError, "Invalid Port: " & getCurrentExceptionMsg())
|