mirror of https://github.com/status-im/nim-eth.git
nat.nim: breaking dependency with 'confutils' (#609)
* nat.nim: breaking dependency with 'confutils' The main purpose of this change is to break the dependency with `confutils`.
This commit is contained in:
parent
6e5ee490c2
commit
285da12bf3
|
@ -11,11 +11,9 @@
|
|||
import
|
||||
std/[options, os, strutils, times],
|
||||
stew/results, nat_traversal/[miniupnpc, natpmp],
|
||||
chronicles, json_serialization/std/net, chronos, confutils,
|
||||
chronicles, json_serialization/std/net, chronos,
|
||||
../common/utils, ./utils as netutils
|
||||
|
||||
export ConfigurationError
|
||||
|
||||
type
|
||||
NatStrategy* = enum
|
||||
NatAny
|
||||
|
@ -323,7 +321,7 @@ type
|
|||
of true: extIp*: ValidIpAddress
|
||||
of false: nat*: NatStrategy
|
||||
|
||||
func parseCmdArg*(T: type NatConfig, p: string): T {.raises: [ConfigurationError].} =
|
||||
func parseCmdArg*(T: type NatConfig, p: string): T {.raises: [ValueError].} =
|
||||
case p.toLowerAscii:
|
||||
of "any":
|
||||
NatConfig(hasExtIp: false, nat: NatAny)
|
||||
|
@ -340,10 +338,10 @@ func parseCmdArg*(T: type NatConfig, p: string): T {.raises: [ConfigurationError
|
|||
NatConfig(hasExtIp: true, extIp: ip)
|
||||
except ValueError:
|
||||
let error = "Not a valid IP address: " & p[6..^1]
|
||||
raise newException(ConfigurationError, error)
|
||||
raise newException(ValueError, error)
|
||||
else:
|
||||
let error = "Not a valid NAT option: " & p
|
||||
raise newException(ConfigurationError, error)
|
||||
raise newException(ValueError, error)
|
||||
|
||||
func completeCmdArg*(T: type NatConfig, val: string): seq[string] =
|
||||
return @[]
|
||||
|
|
Loading…
Reference in New Issue