Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsulClient ¶
type ConsulClient struct {
// contains filtered or unexported fields
}
ConsulClient 是实现 RegistryClient 接口的结构体
func (*ConsulClient) GetServiceURL ¶
func (c *ConsulClient) GetServiceURL(servicename string, groupName ...string) (string, string)
GetServiceURL 方法用于从 Consul 查询服务地址 servicename 是要查询的服务名称 groupName 是可选的服务组名称
func (*ConsulClient) GetServices ¶
func (c *ConsulClient) GetServices(servicename string, groupName ...string) ([]string, error)
GetServices v2 新增:返回该服务在 Consul 上的全部健康实例 URL 列表。 与 GetServiceURL 走同一条 Health().Service 路径,只是不再随机选 1 个。
func (*ConsulClient) Register ¶
func (c *ConsulClient) Register(etcdConfigData []byte)
Register 方法用于向 Consul 注册服务 etcdConfigData 是包含 Consul 配置的字节切片
Click to show internal directories.
Click to hide internal directories.