registry

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalIP

func GetLocalIP(infName string) (string, error)

func NewResolver

func NewResolver(endpoints []string, service string) resolver.Builder

NewResolver return resolver builder endpoints example: http://127.0.0.1:2379 http://127.0.0.1:12379 http://127.0.0.1:22379" service is service name

Types

type Resolver

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

resolver is the implementaion of grpc.resolve.Builder Resolver 实现grpc的grpc.resolve.Builder接口的Build与Scheme方法

func (*Resolver) Build

Build to resolver.Resolver 实现grpc.resolve.Builder接口的方法

func (*Resolver) Close

func (r *Resolver) Close()

Close

func (*Resolver) ResolveNow

func (r *Resolver) ResolveNow(rn resolver.ResolveNowOptions)

ResolveNow

func (*Resolver) Scheme

func (r *Resolver) Scheme() string

Scheme return etcd schema

type Service

type Service struct {
	ServiceInfo   ServiceInfo
	LeaseDruation time.Duration
	Client        *clientv3.Client
	// contains filtered or unexported fields
}

func NewService

func NewService(info ServiceInfo, client *clientv3.Client) *Service

NewService 创建一个注册服务

func (*Service) Start

func (service *Service) Start() (err error)

Start 注册服务启动

func (*Service) Stop

func (service *Service) Stop()

type ServiceInfo

type ServiceInfo struct {
	Name string `json:"name"`
	IP   string `json:"ip"`
	Port int    `json:"port"`
}

服务信息

Jump to

Keyboard shortcuts

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