mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-14 21:40:28 +08:00
33 lines
2.0 KiB
Go
33 lines
2.0 KiB
Go
package serverconfigs
|
||
|
||
import (
|
||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||
"github.com/iwind/TeaGo/maps"
|
||
)
|
||
|
||
const HealthCheckHeaderName = "X-Edge-Health-Check-Key"
|
||
|
||
// HealthCheckConfig 健康检查设置
|
||
type HealthCheckConfig struct {
|
||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
|
||
URL string `yaml:"url" json:"url"` // 读取的URL
|
||
Interval *shared.TimeDuration `yaml:"interval" json:"interval"` // 检测周期
|
||
StatusCodes []int `yaml:"statusCodes" json:"statusCodes"` // 返回的状态码要求
|
||
Timeout *shared.TimeDuration `yaml:"timeout" json:"timeout"` // 超时时间
|
||
CountTries int64 `yaml:"countTries" json:"countTries"` // 尝试次数
|
||
TryDelay *shared.TimeDuration `yaml:"tryDelay" json:"tryDelay"` // 尝试间隔
|
||
FailActions []maps.Map `yaml:"failActions" json:"failActions"` // 失败采取的动作 TODO
|
||
RecoverActions []maps.Map `yaml:"recoverActions" json:"recoverActions"` // 恢复采取的动作 TODO
|
||
AutoDown bool `yaml:"autoDown" json:"autoDown"` // 是否自动下线
|
||
CountUp int `yaml:"countUp" json:"countUp"` // 连续在线认定次数
|
||
CountDown int `yaml:"countDown" json:"countDown"` // 连续离线认定次数
|
||
UserAgent string `yaml:"userAgent" json:"userAgent"` // 发起请求用的UserAgent
|
||
OnlyBasicRequest bool `yaml:"onlyBasicRequest" json:"onlyBasicRequest"` // 只做基础的请求,不处理WAF、反向代理等
|
||
AccessLogIsOn bool `yaml:"accessLogIsOn" json:"accessLogIsOn"` // 是否关闭访问日志
|
||
}
|
||
|
||
// Init 初始化
|
||
func (this *HealthCheckConfig) Init() error {
|
||
return nil
|
||
}
|