register

package
v0.0.0-...-3481ce3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Id        string            `json:"id"`        // 服务id
	Address   string            `json:"address"`   // 服务地址ip或域名+端口
	Advertise string            `json:"advertise"` // 服务注册发现地址
	Metadata  map[string]string `json:"metadata"`  // 服务注册附加信息,可以是系统资源信息 - TODO 当前采用轮训(grpc.WithBalancerName("round_robin"))后期可在此字段做文章
}

Node 服务节点信息

type Option

type Option func(*Options)

Option 实例值设置

func Addrs

func Addrs(addrs ...string) Option

Addrs 服务注册中间件地址

func Logger

func Logger(logger *zap.SugaredLogger) Option

Logger 设置日志对象

func Name

func Name(n string) Option

Name 设置服务名

func Schema

func Schema(s string) Option

Schema 服务注册根路径

func Secure

func Secure(b bool) Option

Secure 服务中间件是否使用加密连接

func TLSConfig

func TLSConfig(t *tls.Config) Option

TLSConfig TLS 加密连接配置

func TTL

func TTL(t int64) Option

TTL 注册信息生存有效期

type Options

type Options struct {
	Schema    string      // 服务注册根路径
	Name      string      // 服务名
	Addrs     []string    // 服务注册中间件地址
	TTL       int64       // 注册信息生存有效期
	Secure    bool        // 是否启用安全连接
	TLSConfig *tls.Config // tls加密连接配置
	Logger    *zap.SugaredLogger
}

Options 注册相关参数

type Register

type Register interface {
	Register(n *Node) error         // 注册一个服务
	UnRegister(n *Node) error       // 取消注册一个服务
	GetResolver() resolver.Resolver // 获取服务名对应服务列表
	GetBuilder() resolver.Builder   // 获取服务名对应服务列表
}

Register 服务注册插件

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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