Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Server ServerConfig `mapstructure:"server"`
Redis RedisConfig `mapstructure:"redis"`
Validator ValidatorConfig `mapstructure:"validator"`
Crawler CrawlerConfig `mapstructure:"crawler"`
Log LogConfig `mapstructure:"log"`
Security SecurityConfig `mapstructure:"security"`
}
var (
GlobalConfig Config
)
func (*Config) GetCheckInterval ¶
func (*Config) GetCrawlerInterval ¶
func (*Config) GetRedisAddr ¶
Helper functions for getting config values
func (*Config) GetValidatorTimeout ¶
type CrawlerConfig ¶
type RedisConfig ¶
type SecurityConfig ¶
type SecurityConfig struct {
// 基本认证
AuthEnabled bool `mapstructure:"auth_enabled"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
// API Key认证
APIKeyEnabled bool `mapstructure:"api_key_enabled"`
APIKeys []string `mapstructure:"api_keys"`
// 限流配置
RateLimit int `mapstructure:"rate_limit"` // 每个时间窗口最大请求数
RateWindow int `mapstructure:"rate_window"` // 时间窗口(分钟)
BanDuration int `mapstructure:"ban_duration"` // 封禁时长(小时)
RateLimitEnabled bool `mapstructure:"rate_limit_enabled"` // 是否启用限流
}
SecurityConfig 安全配置
type ServerConfig ¶
type ValidatorConfig ¶
Click to show internal directories.
Click to hide internal directories.