consul

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 14 Imported by: 0

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) DeRegister

func (c *ConsulClient) DeRegister()

DeRegister 方法用于从 Consul 注销服务

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 配置的字节切片

Jump to

Keyboard shortcuts

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