Versions in this module Expand all Collapse all v1 v1.16.2 Nov 13, 2019 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 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 Node struct + Address string + Id string + Metadata map[string]string + type Option func(*Options) + func Addrs(addrs ...string) Option + func Secure(b bool) Option + func TLSConfig(t *tls.Config) Option + func Timeout(t time.Duration) Option + type Options struct + Addrs []string + Context context.Context + Secure bool + TLSConfig *tls.Config + Timeout time.Duration + type RegisterOption func(*RegisterOptions) + func RegisterTTL(t time.Duration) RegisterOption + type RegisterOptions struct + Context context.Context + TTL time.Duration + type Registry interface + Deregister func(*Service) error + GetService func(string) ([]*Service, error) + Init func(...Option) error + ListServices func() ([]*Service, error) + Options func() Options + Register func(*Service, ...RegisterOption) error + String func() string + Watch func(...WatchOption) (Watcher, error) + 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 Copy(current []*Service) []*Service + func CopyService(service *Service) *Service + func GetService(name string) ([]*Service, error) + func ListServices() ([]*Service, error) + func Merge(olist []*Service, nlist []*Service) []*Service + func Remove(old, del []*Service) []*Service + type Value struct + Name string + Type string + Values []*Value + type WatchOption func(*WatchOptions) + 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)