From 24c15157781faa8aca23e047a115c55768337162 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 d24fd3ea..406615e7 100644 --- a/storage/conf.nim +++ b/storage/conf.nim @@ -52,6 +52,8 @@ export DefaultQuotaBytes, DefaultBlockTtl, DefaultBlockInterval, DefaultNumBlocksPerInterval, DefaultBlockRetries +const DefaultNatScheduleInterval* = 5.minutes + type ThreadCount* = distinct Natural proc `==`*(a, b: ThreadCount): bool {.borrow.} @@ -286,6 +288,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")