rd

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 14 Imported by: 0

README

rd

服务的注册与发现

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalIP

func GetLocalIP() (string, error)

GetLocalIP get the IP address of the current system

physical or virtual machine

Types

type RoundRobin added in v1.2.4

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

func (*RoundRobin) Add added in v1.2.4

func (r *RoundRobin) Add(s string)

func (*RoundRobin) Clear added in v1.2.4

func (r *RoundRobin) Clear()

func (*RoundRobin) Pick added in v1.2.4

func (r *RoundRobin) Pick() string

type ServiceDiscovery

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

func NewClientDiscovery added in v1.2.4

func NewClientDiscovery(serviceName string, endpoints []string) (*ServiceDiscovery, error)

func (*ServiceDiscovery) Build

func (s *ServiceDiscovery) Build() error

func (*ServiceDiscovery) Close

func (s *ServiceDiscovery) Close()

Close 关闭

func (*ServiceDiscovery) DelServiceList

func (s *ServiceDiscovery) DelServiceList(key string)

func (*ServiceDiscovery) GetServerAddr added in v1.2.4

func (s *ServiceDiscovery) GetServerAddr() (string, error)

GetServerAddr return grpc server ip

func (*ServiceDiscovery) SetServiceList

func (s *ServiceDiscovery) SetServiceList(key, val string)

type ServiceOption

type ServiceOption struct {
	Endpoints   []string      // etcd host
	Lease       int64         // etcd lease
	Prefix      string        // prefix,ex:serviceName
	Port        int           // grpc server port
	DialTimeout time.Duration // DialTimeout second
}

ServiceOption service register options

type ServiceRegister

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

func NewServiceRegister

func NewServiceRegister(opt *ServiceOption) (*ServiceRegister, error)

NewServiceRegister return a *ServiceRegister and error

func (*ServiceRegister) Close

func (s *ServiceRegister) Close() error

Close initiative close the lease

func (*ServiceRegister) ListenLeaseRespChan

func (s *ServiceRegister) ListenLeaseRespChan()

ListenLeaseRespChan listen the lease chan

Jump to

Keyboard shortcuts

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