service

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadService

func LoadService(config *Config, opts ...Option) (err error)

Types

type Config

type Config struct {
	ServiceName   string `validate:"required"`
	Type          uint8  `validate:"required,oneof=1 2"`
	Host          string `validate:"required"`
	Port          int    `validate:"required"`
	Selector      string `validate:"required,oneof=wr"` // TODO 后续支持其它
	CaCrt         string
	ClientPem     string
	ClientKey     string
	RefreshSecond int
}

type Option

type Option func(*Service)

func WithDiscovery

func WithDiscovery(discovery registry.Discovery) Option

type Service

type Service struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewService

func NewService(config *Config, opts ...Option) (*Service, error)

func (*Service) Done

func (s *Service) Done(ctx context.Context, node *servicer.Node, err error) error

func (*Service) GetCaCrt

func (s *Service) GetCaCrt() []byte

func (*Service) GetClientKey

func (s *Service) GetClientKey() []byte

func (*Service) GetClientPem

func (s *Service) GetClientPem() []byte

func (*Service) Name

func (s *Service) Name() string

func (*Service) Pick

func (s *Service) Pick(ctx context.Context) (node *servicer.Node, err error)

Jump to

Keyboard shortcuts

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