update cli flags

This commit is contained in:
munna0908 2024-12-18 15:00:48 +05:30 committed by Marcin Czenko
parent 348e61364e
commit a8487ffef1
No known key found for this signature in database
GPG Key ID: 33DEA0C8E30937C0
1 changed files with 14 additions and 13 deletions

View File

@ -37,9 +37,10 @@ import ./logutils
import ./stores import ./stores
import ./units import ./units
import ./utils import ./utils
import ./nat
from ./validationconfig import MaxSlots, ValidationGroups from ./validationconfig import MaxSlots, ValidationGroups
export units, net, codextypes, logutils export units, net, codextypes, logutils,completeCmdArg,parseCmdArg,NatConfig
export ValidationGroups, MaxSlots export ValidationGroups, MaxSlots
export export
@ -139,19 +140,13 @@ type
name: "listen-addrs" }: seq[MultiAddress] name: "listen-addrs" }: seq[MultiAddress]
# TODO: change this once we integrate nat support # TODO: change this once we integrate nat support
nat* {. nat* {.
desc: "IP Addresses to announce behind a NAT" desc: "Specify method to use for determining public address. " &
defaultValue: ValidIpAddress.init("127.0.0.1") "Must be one of: any, none, upnp, pmp, extip:<IP>"
defaultValueDesc: "127.0.0.1" defaultValue: NatConfig(hasExtIp: false, nat: NatAny)
abbr: "a" defaultValueDesc: "any"
name: "nat" }: ValidIpAddress name: "nat" }: NatConfig
discoveryIp* {.
desc: "Discovery listen address"
defaultValue: ValidIpAddress.init(IPv4_any())
defaultValueDesc: "0.0.0.0"
abbr: "e"
name: "disc-ip" }: ValidIpAddress
discoveryPort* {. discoveryPort* {.
desc: "Discovery (UDP) port" desc: "Discovery (UDP) port"
@ -527,6 +522,12 @@ proc readValue*(r: var TomlReader, val: var Duration)
quit QuitFailure quit QuitFailure
val = dur val = dur
proc readValue*(r: var TomlReader, val: var NatConfig)
{.raises: [SerializationError].} =
val = try: parseCmdArg(NatConfig, r.readValue(string))
except CatchableError as err:
raise newException(SerializationError, err.msg)
# no idea why confutils needs this: # no idea why confutils needs this:
proc completeCmdArg*(T: type EthAddress; val: string): seq[string] = proc completeCmdArg*(T: type EthAddress; val: string): seq[string] =
discard discard