Files
EdgeCommon/pkg/serverconfigs/health_check_config.go

33 lines
2.0 KiB
Go
Raw Normal View History

2020-09-13 19:27:47 +08:00
package serverconfigs
import (
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
"github.com/iwind/TeaGo/maps"
)
2020-09-13 19:27:47 +08:00
const HealthCheckHeaderName = "X-Edge-Health-Check-Key"
// HealthCheckConfig 健康检查设置
2020-09-13 19:27:47 +08:00
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"` // 是否关闭访问日志
2020-09-13 19:27:47 +08:00
}
2020-09-27 15:25:52 +08:00
// Init 初始化
2020-09-27 15:25:52 +08:00
func (this *HealthCheckConfig) Init() error {
return nil
}