micro-register-mdns/mdns.go

24 lines
508 B
Go
Raw Normal View History

2019-01-15 19:50:37 +03:00
// Package mdns provides a multicast dns registry
2016-04-27 20:21:05 +03:00
package mdns
import (
2019-09-09 15:11:25 +03:00
"context"
2016-04-27 20:21:05 +03:00
"github.com/micro/go-micro/registry"
)
2019-01-15 19:50:37 +03:00
// NewRegistry returns a new mdns registry
2016-04-27 20:21:05 +03:00
func NewRegistry(opts ...registry.Option) registry.Registry {
2019-01-15 19:50:37 +03:00
return registry.NewRegistry(opts...)
2016-04-27 20:21:05 +03:00
}
2019-09-09 15:11:25 +03:00
// Domain sets the mdnsDomain
func Domain(d string) registry.Option {
return func(o *registry.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, "mdns.domain", d)
}
}