refactor conf

This commit is contained in:
Yuzuki616
2023-08-20 15:13:52 +08:00
parent 42407d5c62
commit 214324496d
19 changed files with 346 additions and 287 deletions

View File

@@ -1,40 +1,40 @@
package conf
type LimitConfig struct {
EnableRealtime bool `yaml:"EnableRealtime"`
SpeedLimit int `yaml:"SpeedLimit"`
IPLimit int `yaml:"DeviceLimit"`
ConnLimit int `yaml:"ConnLimit"`
EnableIpRecorder bool `yaml:"EnableIpRecorder"`
IpRecorderConfig *IpReportConfig `yaml:"IpRecorderConfig"`
EnableDynamicSpeedLimit bool `yaml:"EnableDynamicSpeedLimit"`
DynamicSpeedLimitConfig *DynamicSpeedLimitConfig `yaml:"DynamicSpeedLimitConfig"`
EnableRealtime bool `json:"EnableRealtime"`
SpeedLimit int `json:"SpeedLimit"`
IPLimit int `json:"DeviceLimit"`
ConnLimit int `json:"ConnLimit"`
EnableIpRecorder bool `json:"EnableIpRecorder"`
IpRecorderConfig *IpReportConfig `json:"IpRecorderConfig"`
EnableDynamicSpeedLimit bool `json:"EnableDynamicSpeedLimit"`
DynamicSpeedLimitConfig *DynamicSpeedLimitConfig `json:"DynamicSpeedLimitConfig"`
}
type RecorderConfig struct {
Url string `yaml:"Url"`
Token string `yaml:"Token"`
Timeout int `yaml:"Timeout"`
Url string `json:"Url"`
Token string `json:"Token"`
Timeout int `json:"Timeout"`
}
type RedisConfig struct {
Address string `yaml:"Address"`
Password string `yaml:"Password"`
Db int `yaml:"Db"`
Address string `json:"Address"`
Password string `json:"Password"`
Db int `json:"Db"`
Expiry int `json:"Expiry"`
}
type IpReportConfig struct {
Periodic int `yaml:"Periodic"`
Type string `yaml:"Type"`
RecorderConfig *RecorderConfig `yaml:"RecorderConfig"`
RedisConfig *RedisConfig `yaml:"RedisConfig"`
EnableIpSync bool `yaml:"EnableIpSync"`
Periodic int `json:"Periodic"`
Type string `json:"Type"`
RecorderConfig *RecorderConfig `json:"RecorderConfig"`
RedisConfig *RedisConfig `json:"RedisConfig"`
EnableIpSync bool `json:"EnableIpSync"`
}
type DynamicSpeedLimitConfig struct {
Periodic int `yaml:"Periodic"`
Traffic int64 `yaml:"Traffic"`
SpeedLimit int `yaml:"SpeedLimit"`
ExpireTime int `yaml:"ExpireTime"`
Periodic int `json:"Periodic"`
Traffic int64 `json:"Traffic"`
SpeedLimit int `json:"SpeedLimit"`
ExpireTime int `json:"ExpireTime"`
}