registry

package
v0.0.0-...-bdd2a71 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 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 Conf

type Conf struct {
	Key       string `yaml:"key"`
	Host      string `yaml:"Host" json:",default=0.0.0.0"`
	Port      int    `yaml:"Port"`
	Token     string `yaml:"Token"`
	Frequency int64  `yaml:"Frequency"`
}

type ConsulRegistry

type ConsulRegistry struct {
	ListenOn string

	FetchInterval int64
	Routes
	Predicates
	// contains filtered or unexported fields
}

func NewConsulRegistry

func NewConsulRegistry(conf *Conf) *ConsulRegistry

func (*ConsulRegistry) Deregister

func (c *ConsulRegistry) Deregister()

func (*ConsulRegistry) FetchInstances

func (c *ConsulRegistry) FetchInstances()

func (*ConsulRegistry) Register

func (c *ConsulRegistry) Register(serverInstance ServerInstance, listenOn string)

func (*ConsulRegistry) SetPredicates

func (c *ConsulRegistry) SetPredicates(rs []routes.Route, strategy int)

type DefaultServerInstance

type DefaultServerInstance struct {
	Host     string
	Port     int
	Name     string
	Secure   bool
	Metadata map[string]string
}

func NewDefaultServiceInstance

func NewDefaultServiceInstance(name string, host string, port int, secure bool, metadata map[string]string, instanceId string) (*DefaultServerInstance, error)

func (*DefaultServerInstance) GetHost

func (serviceInstance *DefaultServerInstance) GetHost() string

func (*DefaultServerInstance) GetKey

func (serviceInstance *DefaultServerInstance) GetKey() string

func (*DefaultServerInstance) GetMetadata

func (serviceInstance *DefaultServerInstance) GetMetadata() map[string]string

func (*DefaultServerInstance) GetPort

func (serviceInstance *DefaultServerInstance) GetPort() int

func (*DefaultServerInstance) IsSecure

func (serviceInstance *DefaultServerInstance) IsSecure() bool

type Predicates

type Predicates map[string]server.LoadBalance // url pattern prefix 匹配

type Routes

type Routes map[string]server.LoadBalance // 对应的负载均衡类

type ServerInstance

type ServerInstance interface {
	GetHost() string                //
	GetPort() int                   //
	GetKey() string                 // 返回注册实例的服务名称
	IsSecure() bool                 // 返回注册实例是否使用 HTTPS
	GetMetadata() map[string]string // 返回关联注册实例的元数据键值对
}

type ServerRegistry

type ServerRegistry interface {
	Register(ServerInstance, string)
	Deregister()
	SetPredicates([]routes.Route, int)
	FetchInstances()
}

Jump to

Keyboard shortcuts

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