micro/registry/mdns/mdns.go

24 lines
511 B
Go
Raw Normal View History

2019-01-15 16:50:37 +00:00
// Package mdns provides a multicast dns registry
2016-04-27 18:21:05 +01:00
package mdns
import (
2019-09-09 05:11:25 -07:00
"context"
"github.com/micro/go-micro/v2/registry"
2016-04-27 18:21:05 +01:00
)
2019-01-15 16:50:37 +00:00
// NewRegistry returns a new mdns registry
2016-04-27 18:21:05 +01:00
func NewRegistry(opts ...registry.Option) registry.Registry {
2019-01-15 16:50:37 +00:00
return registry.NewRegistry(opts...)
2016-04-27 18:21:05 +01:00
}
2019-09-09 05:11:25 -07: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)
}
}