nacos

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 13 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 NacosConfig

type NacosConfig struct {
	Enable      bool   `json:"enable"`
	Server      string `json:"server"`
	NamespaceId string `json:"namespaceId"`
	Username    string `json:"username"`
	Password    string `json:"password"`
	Group       string `json:"group"`
	ServiceName string `json:"serviceName"`
	ServiceIp   string `json:"serviceIp"`
}

type NacosPlugin

type NacosPlugin struct {
	Logger *logrus.Entry

	Config *NacosConfig
	Port   int
	// contains filtered or unexported fields
}

func NewNacosPlugin

func NewNacosPlugin(config *NacosConfig, port int) *NacosPlugin

func NewNacosPluginFromYAML

func NewNacosPluginFromYAML(provider *config.Provider, defaultServiceName string, fallbackPort int) (*NacosPlugin, error)

NewNacosPluginFromYAML 通过 Provider 中的 yml 配置创建 Nacos 插件 读取键: nacos.enable, nacos.server, nacos.namespaceId, nacos.username, nacos.password, nacos.group, nacos.serviceName, nacos.serviceIp 端口默认从 addr 解析(格式 host:port),失败则使用 fallbackPort

func (*NacosPlugin) DeregisterFromNacos

func (p *NacosPlugin) DeregisterFromNacos(serviceIp string, port uint64, serviceName string, group string) error

DeregisterFromNacos 使用当前 Nacos 客户端注销一个实例

func (*NacosPlugin) GetAllServiceInstances

func (p *NacosPlugin) GetAllServiceInstances(serviceName string, group string) ([]model.Instance, error)

GetAllServiceInstances 获取指定服务的所有实例

func (*NacosPlugin) GetHealthyServiceInstances

func (p *NacosPlugin) GetHealthyServiceInstances(serviceName string, group string) ([]model.Instance, error)

GetHealthyServiceInstances 获取指定服务的所有健康实例

func (*NacosPlugin) GetPluginConfig

func (p *NacosPlugin) GetPluginConfig() map[string]interface{}

func (*NacosPlugin) GetServiceInstance

func (p *NacosPlugin) GetServiceInstance(serviceName string, group string) (*model.Instance, error)

GetServiceInstance 获取指定服务的一个健康实例

func (*NacosPlugin) OnInit

func (p *NacosPlugin) OnInit(engine *harukap.HarukaAppEngine) error

func (*NacosPlugin) OnShutdown

func (p *NacosPlugin) OnShutdown() error

func (*NacosPlugin) OnStop

func (p *NacosPlugin) OnStop() error

func (*NacosPlugin) RegisterToNacos

func (p *NacosPlugin) RegisterToNacos(serviceIp string, port uint64, serviceName string, group string, metadata map[string]string) error

RegisterToNacos 使用当前 Nacos 客户端注册一个实例

Jump to

Keyboard shortcuts

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