Use .micro domain for mdns

This commit is contained in:
Asim Aslam 2019-09-09 05:11:25 -07:00 committed by Vasiliy Tolstov
parent d1d6608f90
commit de2c6073b7

12
mdns.go
View File

@ -2,6 +2,8 @@
package mdns package mdns
import ( import (
"context"
"github.com/micro/go-micro/registry" "github.com/micro/go-micro/registry"
) )
@ -9,3 +11,13 @@ import (
func NewRegistry(opts ...registry.Option) registry.Registry { func NewRegistry(opts ...registry.Option) registry.Registry {
return registry.NewRegistry(opts...) return registry.NewRegistry(opts...)
} }
// 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)
}
}