0 Star 1 Fork 0

shallot/Go开发工具集

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
consul_options.go 1.76 KB
一键复制 编辑 原始数据 按行查看 历史
shallot 提交于 2024-12-17 15:56 +08:00 . 添加gomicro精简的微服务框架。
package gomicro
import (
"time"
consul "github.com/hashicorp/consul/api"
)
type ConsulOptions struct {
Addrs []string // 服务地址
Timeout time.Duration // 超时时间
Connect bool // Connect specifies services should be registered as Consul Connect services.
ConsulConfig *consul.Config // API的配置信息
DenyStale bool // AllowStale sets whether any Consul server (non-leader) can service a read. This allows for lower latency and higher throughput at the cost of potentially stale data. Works similar to Consul DNS Config option [1]. Defaults to true. [1] https://www.consul.io/docs/agent/options.html#allow_stale
QueryOptions *consul.QueryOptions // QueryOptions specifies the QueryOptions to be used when calling Consul. See `Consul API` for more information [1]. [1] https://godoc.org/github.com/hashicorp/consul/api#QueryOptions
TCPCheck time.Duration // TCPCheck will tell the service provider to check the service address and port every `t` interval. It will enabled only if `t` is greater than 0. See `TCP + Interval` for more information [1]. [1] https://www.consul.io/docs/agent/checks.html
/*
=> protocol, port, httpEndpoint string, interval, timeout time.Duration
consul.AgentServiceCheck{
HTTP: fmt.Sprintf("%s://{host}:%s%s", protocol, port, httpEndpoint),
Interval: fmt.Sprintf("%v", interval),
Timeout: fmt.Sprintf("%v", timeout),
}
*/
HTTPCheck *consul.AgentServiceCheck // HTTPCheck will tell the service provider to invoke the health check endpoint with an interval and timeout. It will be enabled only if interval and timeout are greater than 0. See `HTTP + Interval` for more information [1]. [1] https://www.consul.io/docs/agent/checks.html
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/gxsshallot/gotool.git
git@gitee.com:gxsshallot/gotool.git
gxsshallot
gotool
Go开发工具集
d05a69787598

搜索帮助