Documentation
¶
Index ¶
Constants ¶
View Source
const (
WorkDir = ".pt-tools"
)
Variables ¶
View Source
var DefaultZapConfig = Zap{ Directory: "logs", MaxSize: 10, MaxAge: 30, MaxBackups: 10, Compress: true, Level: "info", Format: "console", ShowLine: false, EncodeLevel: "CapitalColorLevelEncoder", StacktraceKey: "", LogInConsole: true, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Global GlobalConfig `mapstructure:"global"` // 全局默认配置
// Zap Zap `mapstructure:"zap"`
Qbit QbitConfig `mapstructure:"qbit"` // 全局 qBittorrent 配置
Sites map[models.SiteGroup]SiteConfig `mapstructure:"sites"` // 多个站点配置
}
完整配置
type GlobalConfig ¶
type GlobalConfig struct {
DefaultInterval time.Duration `mapstructure:"default_interval"`
DefaultEnabled bool `mapstructure:"default_enabled"`
DownloadDir string `mapstructure:"download_dir"`
DownloadLimitEnabled bool `mapstructure:"download_limit_enabled"`
DownloadSpeedLimit int `mapstructure:"download_speed_limit"`
TorrentSizeGB int `mapstructure:"torrent_size_gb"`
}
全局配置
type QbitConfig ¶
type QbitConfig struct {
Enabled bool `mapstructure:"enabled"` // 是否启用
URL string `mapstructure:"url"` // qBittorrent API URL
User string `mapstructure:"user"` // qBittorrent 用户名
Password string `mapstructure:"password"` // qBittorrent 密码
}
qBittorrent 配置
type RSSConfig ¶
type RSSConfig struct {
Name string `mapstructure:"name"`
URL string `mapstructure:"url"` // RSS 订阅链接
Category string `mapstructure:"category"` // qBittorrent 分类
Tag string `mapstructure:"tag"` // qBittorrent 标签
IntervalMinutes int32 `mapstructure:"interval_minutes"` // 抓取间隔(覆盖全局)
DownloadSubPath string `mapstructure:"download_sub_path"` // 下载目录
}
单个 RSS 配置
type SiteConfig ¶
type SiteConfig struct {
Enabled *bool `mapstructure:"enabled"` // 是否启用,优先级高于全局默认值
AuthMethod string `mapstructure:"auth_method"` // 认证方式: "cookie" 或 "api_key"
Cookie string `mapstructure:"cookie"` // 登录 Cookie
APIKey string `mapstructure:"api_key"` // API Token(如果需要)
APIUrl string `mapstructure:"api_url"`
RSS []RSSConfig `mapstructure:"rss"` // 多个 RSS 配置
}
单个站点的配置
type Zap ¶
type Zap struct {
Directory string `mapstructure:"directory" json:"directory" yaml:"directory"`
MaxSize int `mapstructure:"max_size" json:"max_size" yaml:"max_size"`
MaxAge int `mapstructure:"max_age" json:"max_age" yaml:"max_age"`
MaxBackups int `mapstructure:"max_backups" json:"max_backups" yaml:"max_backups"`
Compress bool `mapstructure:"compress" json:"compress" yaml:"compress"`
Level string `mapstructure:"level" json:"level" yaml:"level"` // debug info warn error
Format string `mapstructure:"format" json:"format" yaml:"format"`
EncodeLevel string `mapstructure:"encode_level" json:"encode_level" yaml:"encode_level"`
StacktraceKey string `mapstructure:"stacktrace_key" json:"stacktrace_key" yaml:"stacktrace_key"`
LogInConsole bool `mapstructure:"log_in_console" json:"log_in_console" yaml:"log_in_console"`
ShowLine bool `mapstructure:"show_line" json:"show_line" yaml:"show_line"`
}
func (*Zap) ZapEncodeLevel ¶
func (z *Zap) ZapEncodeLevel() zapcore.LevelEncoder
Click to show internal directories.
Click to hide internal directories.