From de2c6073b72617a43b1efcc215cf98d571a51d7b Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Mon, 9 Sep 2019 05:11:25 -0700 Subject: [PATCH] Use .micro domain for mdns --- mdns.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mdns.go b/mdns.go index 6739c69..f84e896 100644 --- a/mdns.go +++ b/mdns.go @@ -2,6 +2,8 @@ package mdns import ( + "context" + "github.com/micro/go-micro/registry" ) @@ -9,3 +11,13 @@ import ( func NewRegistry(opts ...registry.Option) registry.Registry { 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) + } +}