diff --git a/registry/consul_registry.go b/registry/consul_registry.go index 80beb393..ffd1cd71 100644 --- a/registry/consul_registry.go +++ b/registry/consul_registry.go @@ -17,7 +17,7 @@ import ( type consulRegistry struct { Address string Client *consul.Client - Options Options + opts Options sync.Mutex register map[string]uint64 @@ -94,7 +94,7 @@ func newConsulRegistry(opts ...Option) Registry { cr := &consulRegistry{ Address: config.Address, Client: client, - Options: options, + opts: options, register: make(map[string]uint64), } @@ -286,3 +286,7 @@ func (c *consulRegistry) Watch(opts ...WatchOption) (Watcher, error) { func (c *consulRegistry) String() string { return "consul" } + +func (c *consulRegistry) Options() Options { + return c.opts +} diff --git a/registry/mdns/mdns.go b/registry/mdns/mdns.go index d8ffef7a..1b942875 100644 --- a/registry/mdns/mdns.go +++ b/registry/mdns/mdns.go @@ -322,6 +322,10 @@ func (m *mdnsRegistry) String() string { return "mdns" } +func (m *mdnsRegistry) Options() registry.Options { + return m.opts +} + func NewRegistry(opts ...registry.Option) registry.Registry { return newRegistry(opts...) } diff --git a/registry/mock/mock.go b/registry/mock/mock.go index 947feb30..1c248b3e 100644 --- a/registry/mock/mock.go +++ b/registry/mock/mock.go @@ -99,6 +99,10 @@ func (m *mockRegistry) String() string { return "mock" } +func (m *mockRegistry) Options() registry.Options { + return registry.Options{} +} + func NewRegistry() registry.Registry { m := &mockRegistry{Services: make(map[string][]*registry.Service)} m.init() diff --git a/registry/registry.go b/registry/registry.go index 25e647ab..489517f5 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -15,6 +15,7 @@ type Registry interface { ListServices() ([]*Service, error) Watch(...WatchOption) (Watcher, error) String() string + Options() Options } type Option func(*Options)