From e27db2def6ff828b2415a5167553c830fc838f33 Mon Sep 17 00:00:00 2001 From: Mmx Date: Tue, 24 Sep 2024 23:53:27 +0800 Subject: [PATCH] improve: move backoff to global module --- internal/config/backoff.go | 2 +- internal/config/models.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/config/backoff.go b/internal/config/backoff.go index 0195e71..0e2d725 100644 --- a/internal/config/backoff.go +++ b/internal/config/backoff.go @@ -8,7 +8,7 @@ import ( var BackoffConfig backoff.Conf func initBackoff() { - setting := Settings.Guardian.Backoff + setting := Settings.Backoff BackoffConfig = backoff.Conf{ Logger: Logger, DisableRecovery: true, diff --git a/internal/config/models.go b/internal/config/models.go index 05de3c9..b3d50b5 100644 --- a/internal/config/models.go +++ b/internal/config/models.go @@ -8,12 +8,12 @@ import ( type ( GuardianConf struct { - Enable bool `json:"enable" yaml:"enable"` - Duration uint `json:"duration" yaml:"duration"` - Backoff BackoffConf `json:"backoff" yaml:"backoff"` + Enable bool `json:"enable" yaml:"enable"` + Duration uint `json:"duration" yaml:"duration"` } BackoffConf struct { + Enable bool `json:"enable" yaml:"enable"` MaxRetries uint `json:"max_retries" yaml:"max_retries"` InitialDuration uint `json:"initial_duration" yaml:"initial_duration"` MaxDuration uint `json:"max_duration" yaml:"max_duration"` @@ -60,6 +60,7 @@ type ( type SettingsConf struct { Basic BasicConf `json:"basic" yaml:"basic"` Guardian GuardianConf `json:"guardian" yaml:"guardian"` + Backoff BackoffConf `json:"backoff" yaml:"backoff"` Log LogConf `json:"log" yaml:"log"` DDNS DdnsConf `json:"ddns" yaml:"ddns"` Reality RealityConf `json:"reality" yaml:"reality"`