Files
EdgeCommon/pkg/serverconfigs/health_check_config.go
2022-05-19 17:13:26 +08:00

33 lines
2.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}