Documentation ¶
Index ¶
- type CheckResponse
- type Config
- type Discovery
- type HttpRouter
- type KV
- type Option
- func WithCheckAddr(addr string) Option
- func WithCheckGrpc(router HttpRouter, checkPath ...string) Option
- func WithCheckHTTP(router HttpRouter, checkHttp ...string) Option
- func WithCheckPort(port int) Option
- func WithCheckTCP() Option
- func WithCheckType(checkType string) Option
- func WithDeregisterTime(deregisterTime int) Option
- func WithEnableHealthyStatus() Option
- func WithId(id string) Option
- func WithIntervalTime(intervalTime int) Option
- func WithName(name string) Option
- func WithRegisterAddr(addr string) Option
- func WithRegisterPort(port int) Option
- func WithTags(tags ...string) Option
- func WithTimeOut(timeOut int) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResponse ¶
func (*CheckResponse) GetOnTime ¶
func (r *CheckResponse) GetOnTime() int64
func (*CheckResponse) Result ¶
func (r *CheckResponse) Result() string
func (*CheckResponse) SetHealthy ¶
func (r *CheckResponse) SetHealthy(healthy string)
type Config ¶
type Config struct { Id string Name string RegisterAddr string RegisterPort int CheckAddr string CheckPort int Tags []string IntervalTime int // 健康检查间隔 DeregisterTime int //check失败后30秒删除本服务,注销时间,相当于过期时间 TimeOut int HttpRouter HttpRouter CheckHealthyStatus bool CheckResponse *CheckResponse CheckType string // 检查类型 HTTP TCP GRPC CheckPath string }
type HttpRouter ¶
type HttpRouter func(r *CheckResponse)
type Option ¶
type Option func(*Config)
Option for queue system
func WithCheckGrpc ¶
func WithCheckGrpc(router HttpRouter, checkPath ...string) Option
WithCheckGrpc set checkHttp function r.GET(url, func(c *gin.Context) { c.String(200, "Healthy") })
func WithCheckHTTP ¶
func WithCheckHTTP(router HttpRouter, checkHttp ...string) Option
WithCheckHTTP set checkHttp function r.GET(url, func(c *gin.Context) { c.String(200, "Healthy") })
func WithCheckTCP ¶
func WithCheckTCP() Option
WithCheckTCP set checkHttp function r.GET(url, func(c *gin.Context) { c.String(200, "Healthy") })
func WithDeregisterTime ¶
WithDeregisterTime set deregisterTime function
func WithEnableHealthyStatus ¶
func WithEnableHealthyStatus() Option
WithEnableHealthyStatus checkHealthyStatus function
func WithIntervalTime ¶
WithIntervalTime set intervalTime function
func WithRegisterAddr ¶
WithRegisterAddr set addr function
Click to show internal directories.
Click to hide internal directories.