From 281d5e3bcca08cf3849dc6da02b7040b2de37265 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Fri, 10 Apr 2026 18:26:27 +0400 Subject: [PATCH] Add autonat conf --- storage/conf.nim | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/storage/conf.nim b/storage/conf.nim index 2937bad4..300d7c0a 100644 --- a/storage/conf.nim +++ b/storage/conf.nim @@ -53,6 +53,8 @@ export DefaultQuotaBytes, DefaultBlockTtl, DefaultBlockInterval, DefaultNumBlocksPerInterval, DefaultBlockRetries +const DefaultNatScheduleInterval* = 5.minutes + type ThreadCount* = distinct Natural proc `==`*(a, b: ThreadCount): bool {.borrow.} @@ -309,6 +311,31 @@ type desc: "Logs to file", defaultValue: string.none, name: "log-file", hidden .}: Option[string] + natScheduleInterval* {. + desc: "Interval between AutoNAT reachability checks", + defaultValue: DefaultNatScheduleInterval, + defaultValueDesc: $DefaultNatScheduleInterval, + name: "nat-schedule-interval" + .}: Duration + + natNumPeersToAsk* {. + desc: "Number of peers to ask per AutoNAT round", + defaultValue: 3, + name: "nat-num-peers-to-ask" + .}: int + + natMaxQueueSize* {. + desc: "Number of past AutoNAT results kept to calculate confidence", + defaultValue: 3, + name: "nat-max-queue-size" + .}: int + + natMinConfidence* {. + desc: "Minimum confidence threshold to confirm reachability", + defaultValue: 0.7, + name: "nat-min-confidence" + .}: float + func defaultAddress*(conf: StorageConf): IpAddress = result = static parseIpAddress("127.0.0.1")