health

package
v1.20.41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2024 License: Zlib Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckFunc

type CheckFunc func(node *Node) error

type Config

type Config struct {
	MaxCount int `json:"maxCount"`
	// 检测秒
	Interval    time.Duration `json:"interval"`
	EnableAlarm bool          `json:"enableAlarm"`
}

type Health

type Health struct {
	// contains filtered or unexported fields
}

func New

func New(conf Config) *Health

func (*Health) AddNode

func (ch *Health) AddNode(id string, node *Node)

func (*Health) DelNode

func (ch *Health) DelNode(id string)

func (*Health) Start

func (ch *Health) Start() error

func (*Health) Stop

func (ch *Health) Stop()

type Node

type Node struct {
	Health server.Health
	// http检测后,服务器返回的body,由业务根据情况不同去解释
	Unpack Unpack
	// 可以配自己的检测函数
	Check CheckFunc
	// 结点状态
	Status int
	// contains filtered or unexported fields
}

func (Node) Id

func (n Node) Id() string

func (Node) URL

func (n Node) URL() string

type Unpack

type Unpack func(body []byte, node *Node) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL