naming

package
v0.0.0-...-4c4187b Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Naming

type Naming struct {
	// contains filtered or unexported fields
}

Naming 基于ETCD的服务注册与发现

func NewNaming

func NewNaming(options ...func(*Naming)) *Naming

func (*Naming) Deregister

func (n *Naming) Deregister(serviceName, addr string) error

Deregister 释放

func (*Naming) GetClientConn

func (n *Naming) GetClientConn(serviceName string) (*grpc.ClientConn, error)

GetClientConn 得到grpc客户端连接

func (*Naming) GetConfig

func (n *Naming) GetConfig() etcdClientV3.Config

func (*Naming) GetGrpcProxyEndpoint

func (n *Naming) GetGrpcProxyEndpoint(serviceName string) string

GetGrpcProxyEndpoint 获取proxy endpoint

func (*Naming) GetResolver

func (n *Naming) GetResolver(serviceName string) error

////////////////////////////////////////////////////////////////

Resolver

//////////////////////////////////////////////////////////////// GetResolver 命名解析

func (*Naming) Register

func (n *Naming) Register(serviceName, addr string) error

Register 服务注册

type NamingOption

type NamingOption func(*Naming)

func WithAddress

func WithAddress(addrs []string) NamingOption

func WithDialTimeout

func WithDialTimeout(dialTimeout time.Duration) NamingOption

func WithPrefix

func WithPrefix(prefix string) NamingOption

type ServiceInfo

type ServiceInfo struct {
	Name              string //服务名
	Addr              string //服务地址
	GrpcProxyEndpoint string //etcd注册endpoint
}

Jump to

Keyboard shortcuts

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