Add Init to all things, use init in cmd package to initialise

This commit is contained in:
Asim Aslam 2018-08-08 18:57:29 +01:00 committed by Vasiliy Tolstov
parent b2de9ebfd0
commit 54f596e470

15
mdns.go
View File

@ -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 { func (m *mdnsRegistry) Register(service *registry.Service, opts ...registry.RegisterOption) error {
m.Lock() m.Lock()
defer m.Unlock() defer m.Unlock()
@ -322,10 +333,6 @@ func (m *mdnsRegistry) String() string {
return "mdns" return "mdns"
} }
func (m *mdnsRegistry) Options() registry.Options {
return m.opts
}
func NewRegistry(opts ...registry.Option) registry.Registry { func NewRegistry(opts ...registry.Option) registry.Registry {
return newRegistry(opts...) return newRegistry(opts...)
} }