feat: support custom tracker url (#59)

This commit is contained in:
Li Wei authored and GitHub committed 2022-12-12 15:58:11 +08:00
1 parent 9ef3405e43
commit 691c2f496e
71 files changed
+2209 -891

No files matched your search

+4 -24
View File
@@ -15,6 +15,7 @@ type StartConfig struct {
Storage Storage `json:"storage"`
StorageDir string `json:"storageDir"`
RefreshInterval int `json:"refreshInterval"`
ApiToken string `json:"apiToken"`
WebEnable bool
WebFS fs.FS
@@ -24,6 +25,9 @@ func (cfg *StartConfig) Init() *StartConfig {
if cfg.Network == "" {
cfg.Network = "tcp"
}
if cfg.Address == "" {
cfg.Address = "127.0.0.1:0"
}
if cfg.Storage == "" {
cfg.Storage = StorageBolt
}
@@ -32,27 +36,3 @@ func (cfg *StartConfig) Init() *StartConfig {
}
return cfg
}
// ServerConfig is present in the database
type ServerConfig struct {
Host string `json:"host"`
Port int `json:"port"`
Connections int `json:"connections"`
DownloadDir string `json:"downloadDir"`
Extra map[string]any `json:"extra"`
}
func (cfg *ServerConfig) Init() *ServerConfig {
if cfg.Host == "" {
cfg.Host = "127.0.0.1"
}
if cfg.Port < 0 {
cfg.Port = 0
}
if cfg.Connections <= 0 {
cfg.Connections = 16
}
return cfg
}