consul

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpProtocol = "http"
	TcpProtocol  = "tcp"
	GrpcProtocol = "grpc"
)

Variables

This section is empty.

Functions

func AddService added in v0.3.48

func AddService(serviceName string)

添加服务信息

func AddServices added in v0.3.48

func AddServices(consumerServiceNames []string)

func GetConfig

func GetConfig() *api.Config

func IsRegister added in v0.1.6

func IsRegister(name string, protocol string, address string, port int) bool

func RegisterServer added in v0.1.0

func RegisterServer(name string, protocol string, address string, port int, check *api.AgentServiceCheck) (b bool, err error)

func RemoveService added in v0.3.48

func RemoveService(serviceName string)

移除服务信息

Types

type Service

type Service struct {
	service.BaseStruct
}

func (*Service) PreEvents added in v0.7.0

func (*Service) PreEvents() []string

func (*Service) Start

func (*Service) Start(_ *sync.WaitGroup)

type ServiceNode

type ServiceNode struct {
	ServiceName string
	Address     string
	Port        string
	CheckStatus string
	Protocol    string
	IsRemove    bool //节点是否被移除
	// contains filtered or unexported fields
}

func GetNode

func GetNode(serviceName string, protocol string) (node *ServiceNode, err error)

func (*ServiceNode) OnRemove added in v0.3.53

func (node *ServiceNode) OnRemove(_func func())

监听节点被移除事件

Jump to

Keyboard shortcuts

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