From 54f596e4704efb0d2f5228c367c820b07b63ef49 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 8 Aug 2018 18:57:29 +0100 Subject: [PATCH] Add Init to all things, use init in cmd package to initialise --- mdns.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mdns.go b/mdns.go index 1b94287..6ff6ad1 100644 --- a/mdns.go +++ b/mdns.go @@ -49,6 +49,17 @@ func newRegistry(opts ...registry.Option) registry.Registry { } } +func (m *mdnsRegistry) Init(opts ...registry.Option) error { + for _, o := range opts { + o(&m.opts) + } + return nil +} + +func (m *mdnsRegistry) Options() registry.Options { + return m.opts +} + func (m *mdnsRegistry) Register(service *registry.Service, opts ...registry.RegisterOption) error { m.Lock() defer m.Unlock() @@ -322,10 +333,6 @@ 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...) }