Versions in this module Expand all Collapse all v4 v4.9.0 Jul 31, 2024 Changes in this version + var DefaultRegistry = NewRegistry() + var ErrNotFound = errors.New("service not found") + var ErrWatcherStopped = errors.New("watcher stopped") + func Deregister(s *Service) error + func Register(s *Service, opts ...RegisterOption) error + func String() string + type DeregisterOption func(*DeregisterOptions) + func DeregisterContext(ctx context.Context) DeregisterOption + type DeregisterOptions struct + Context context.Context + type Endpoint struct + Metadata map[string]string + Name string + Request *Value + Response *Value + type Event struct + Id string + Service *Service + Timestamp time.Time + Type EventType + type EventType int + const Create + const Delete + const Update + func (t EventType) String() string + type GetOption func(*GetOptions) + func GetContext(ctx context.Context) GetOption + type GetOptions struct + Context context.Context + type ListOption func(*ListOptions) + func ListContext(ctx context.Context) ListOption + type ListOptions struct + Context context.Context + type Node struct + Address string + Id string + Metadata map[string]string + type Option func(*Options) + func Addrs(addrs ...string) Option + func Logger(l logger.Logger) Option + func Secure(b bool) Option + func Services(s map[string][]*Service) Option + func TLSConfig(t *tls.Config) Option + func Timeout(t time.Duration) Option + type Options struct + Addrs []string + Context context.Context + Logger logger.Logger + Secure bool + TLSConfig *tls.Config + Timeout time.Duration + func NewOptions(opts ...Option) *Options + type RegisterOption func(*RegisterOptions) + func RegisterContext(ctx context.Context) RegisterOption + func RegisterTTL(t time.Duration) RegisterOption + type RegisterOptions struct + Context context.Context + TTL time.Duration + type Registry interface + Deregister func(*Service, ...DeregisterOption) error + GetService func(string, ...GetOption) ([]*Service, error) + Init func(...Option) error + ListServices func(...ListOption) ([]*Service, error) + Options func() Options + Register func(*Service, ...RegisterOption) error + String func() string + Watch func(...WatchOption) (Watcher, error) + func NewMemoryRegistry(opts ...Option) Registry + func NewRegistry(opts ...Option) Registry + type Result struct + Action string + Service *Service + type Service struct + Endpoints []*Endpoint + Metadata map[string]string + Name string + Nodes []*Node + Version string + func GetService(name string) ([]*Service, error) + func ListServices() ([]*Service, error) + type Value struct + Name string + Type string + Values []*Value + type WatchOption func(*WatchOptions) + func WatchContext(ctx context.Context) WatchOption + func WatchService(name string) WatchOption + type WatchOptions struct + Context context.Context + Service string + type Watcher interface + Next func() (*Result, error) + Stop func() + func Watch(opts ...WatchOption) (Watcher, error)