discovery

package
v0.0.0-...-2400502 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPrefix

func BuildPrefix(server Server) string

func BuildRegisterPath

func BuildRegisterPath(server Server) string

func BuildResolverUrl

func BuildResolverUrl(app string) string

func Exist

func Exist(l []resolver.Address, addr resolver.Address) bool

Exist helper function

func Remove

func Remove(s []resolver.Address, addr resolver.Address) ([]resolver.Address, bool)

Remove helper function

Types

type Register

type Register struct {
	EtcdAddrs   []string
	DialTimeout int
	// contains filtered or unexported fields
}

func NewRegister

func NewRegister(etcdAddrs []string, logger *logrus.Logger) *Register

NewRegister create a register based on etcd

func (*Register) GetServerInfo

func (r *Register) GetServerInfo() (Server, error)

func (*Register) Register

func (r *Register) Register(srvInfo Server, ttl int64) (chan<- struct{}, error)

Register a user

func (*Register) Stop

func (r *Register) Stop()

Stop stop register

func (*Register) UpdateHandler

func (r *Register) UpdateHandler() http.HandlerFunc

type Resolver

type Resolver struct {
	EtcdAddrs   []string
	DialTimeout int
	// contains filtered or unexported fields
}

Resolver for grpc client

func NewResolver

func NewResolver(etcdAddrs []string, logger *logrus.Logger) *Resolver

NewResolver create a new resolver.Builder base on etcd

func (*Resolver) Build

Build creates a new resolver.Resolver for the given target

func (*Resolver) Close

func (r *Resolver) Close()

Close resolver.Resolver interface

func (*Resolver) ResolveNow

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

ResolveNow resolver.Resolver interface

func (*Resolver) Scheme

func (r *Resolver) Scheme() string

Scheme returns the scheme supported by this resolver.

type Server

type Server struct {
	Name    string `json:"name"`
	Addr    string `json:"addr"`    // 地址
	Version string `json:"version"` // 版本
	Weight  int64  `json:"weight"`  // 权重
}

func ParseValue

func ParseValue(value []byte) (Server, error)

func SplitPath

func SplitPath(path string) (Server, error)

Jump to

Keyboard shortcuts

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