2026-01-28 17:22:29 +01:00
|
|
|
package conf
|
|
|
|
|
|
|
|
|
|
import "sync"
|
|
|
|
|
|
|
|
|
|
type Config struct {
|
2026-03-03 16:38:24 +01:00
|
|
|
Name string
|
|
|
|
|
Hostname string
|
|
|
|
|
PSKPath string
|
|
|
|
|
PublicKeyPath string
|
|
|
|
|
PrivateKeyPath string
|
|
|
|
|
NodeEndpointPort int64
|
2026-03-11 16:28:15 +01:00
|
|
|
IndexerAddresses string
|
2026-01-28 17:22:29 +01:00
|
|
|
|
2026-02-03 15:25:15 +01:00
|
|
|
PeerIDS string // TO REMOVE
|
|
|
|
|
|
2026-01-30 16:57:36 +01:00
|
|
|
NodeMode string
|
2026-03-03 16:38:24 +01:00
|
|
|
|
|
|
|
|
MinIndexer int
|
|
|
|
|
MaxIndexer int
|
2026-03-11 16:28:15 +01:00
|
|
|
// SearchTimeout is the max duration without a new result before the
|
|
|
|
|
// distributed peer search stream is closed. Default: 5s.
|
|
|
|
|
SearchTimeout int // seconds; 0 → use default (5)
|
|
|
|
|
|
|
|
|
|
// Indexer connection burst guard: max new connections accepted within the window.
|
|
|
|
|
// 0 → use defaults (20 new peers per 30s).
|
|
|
|
|
MaxConnPerWindow int // default 20
|
|
|
|
|
ConnWindowSecs int // default 30
|
|
|
|
|
|
|
|
|
|
// Per-node behavioral limits (sliding 60s window). 0 → use built-in defaults.
|
|
|
|
|
MaxHBPerMinute int // default 5
|
|
|
|
|
MaxPublishPerMinute int // default 10
|
|
|
|
|
MaxGetPerMinute int // default 50
|
2026-01-28 17:22:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var instance *Config
|
|
|
|
|
var once sync.Once
|
|
|
|
|
|
|
|
|
|
func GetConfig() *Config {
|
|
|
|
|
once.Do(func() {
|
|
|
|
|
instance = &Config{}
|
|
|
|
|
})
|
|
|
|
|
return instance
|
|
|
|
|
}
|