improve: move backoff to global module

This commit is contained in:
Mmx
2024-09-24 23:53:27 +08:00
parent 5fa863a35e
commit e27db2def6
2 changed files with 5 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ import (
var BackoffConfig backoff.Conf var BackoffConfig backoff.Conf
func initBackoff() { func initBackoff() {
setting := Settings.Guardian.Backoff setting := Settings.Backoff
BackoffConfig = backoff.Conf{ BackoffConfig = backoff.Conf{
Logger: Logger, Logger: Logger,
DisableRecovery: true, DisableRecovery: true,

View File

@@ -8,12 +8,12 @@ import (
type ( type (
GuardianConf struct { GuardianConf struct {
Enable bool `json:"enable" yaml:"enable"` Enable bool `json:"enable" yaml:"enable"`
Duration uint `json:"duration" yaml:"duration"` Duration uint `json:"duration" yaml:"duration"`
Backoff BackoffConf `json:"backoff" yaml:"backoff"`
} }
BackoffConf struct { BackoffConf struct {
Enable bool `json:"enable" yaml:"enable"`
MaxRetries uint `json:"max_retries" yaml:"max_retries"` MaxRetries uint `json:"max_retries" yaml:"max_retries"`
InitialDuration uint `json:"initial_duration" yaml:"initial_duration"` InitialDuration uint `json:"initial_duration" yaml:"initial_duration"`
MaxDuration uint `json:"max_duration" yaml:"max_duration"` MaxDuration uint `json:"max_duration" yaml:"max_duration"`
@@ -60,6 +60,7 @@ type (
type SettingsConf struct { type SettingsConf struct {
Basic BasicConf `json:"basic" yaml:"basic"` Basic BasicConf `json:"basic" yaml:"basic"`
Guardian GuardianConf `json:"guardian" yaml:"guardian"` Guardian GuardianConf `json:"guardian" yaml:"guardian"`
Backoff BackoffConf `json:"backoff" yaml:"backoff"`
Log LogConf `json:"log" yaml:"log"` Log LogConf `json:"log" yaml:"log"`
DDNS DdnsConf `json:"ddns" yaml:"ddns"` DDNS DdnsConf `json:"ddns" yaml:"ddns"`
Reality RealityConf `json:"reality" yaml:"reality"` Reality RealityConf `json:"reality" yaml:"reality"`