consul

package
v2.0.18 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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