gitee.com/h79/goutils@v1.22.10/discovery/health/node.go (about) 1 package health 2 3 import "gitee.com/h79/goutils/common/server" 4 5 type Unpack func(body []byte, node *Node) error 6 type CheckFunc func(node *Node) error 7 8 type Node struct { 9 Health server.Health 10 // http检测后,服务器返回的body,由业务根据情况不同去解释 11 Unpack Unpack 12 // 可以配自己的检测函数 13 Check CheckFunc 14 // 结点状态 15 Status int 16 // 错误几次 17 errCount int 18 } 19 20 func (n Node) URL() string { 21 return n.Health.URL.To() 22 } 23 24 func (n Node) Id() string { 25 return n.Health.URL.To() 26 }