From 285da12bf318a2e21182dc2453a4a30c58f73067 Mon Sep 17 00:00:00 2001 From: Ivan Folgueira Bande <128452529+Ivansete-status@users.noreply.github.com> Date: Tue, 16 May 2023 13:43:31 +0200 Subject: [PATCH] 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`. --- eth/net/nat.nim | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/eth/net/nat.nim b/eth/net/nat.nim index 4d4e71d..5ec4675 100644 --- a/eth/net/nat.nim +++ b/eth/net/nat.nim @@ -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 @[]