mdns

package module
v0.0.0-...-b87209e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 23 Imported by: 3

README

mdns registry

This is the mDNS Registry for Orb, it's basicaly a copy & paste from go-micro.dev/v4.

Documentation

Overview

Package mdns provides a multicast dns registry

Index

Constants

View Source
const Name = "mdns"

Name provides the name of this registry.

Variables

View Source
var (
	DefaultDomain = "micro"
)

Defaults.

Functions

func ProvideRegistryMDNS

func ProvideRegistryMDNS(
	name types.ServiceName,
	version types.ServiceVersion,
	datas types.ConfigData,
	logger log.Logger,
	opts ...registry.Option,
) (registry.Type, error)

ProvideRegistryMDNS creates a new MDNS registry.

func WithDomain

func WithDomain(domain string) registry.Option

WithDomain sets the mDNS domain.

Types

type Config

type Config struct {
	registry.Config `yaml:",inline"`

	Domain string `json:"domain,omitempty" yaml:"domain,omitempty"`
}

Config provides configuration for the mDNS registry.

func NewConfig

func NewConfig(
	serviceName types.ServiceName,
	datas types.ConfigData,
	opts ...registry.Option,
) (Config, error)

NewConfig creates a new config object.

type RegistryMDNS

type RegistryMDNS struct {
	sync.Mutex
	// contains filtered or unexported fields
}

RegistryMDNS implements the registry interface. It runs a MDNS service registry.

func New

func New(serviceName string, serviceVersion string, cfg Config, log log.Logger) *RegistryMDNS

New creates a new mdns registry. This functions should rarely be called manually. To create a new registry use ProvideRegistryMDNS.

func (*RegistryMDNS) Deregister

func (m *RegistryMDNS) Deregister(service *registry.Service, _ ...registry.DeregisterOption) error

Deregister a service from the registry.

func (*RegistryMDNS) GetService

func (m *RegistryMDNS) GetService(service string, _ ...registry.GetOption) ([]*registry.Service, error)

GetService fetches a service from the registry.

func (*RegistryMDNS) ListServices

func (m *RegistryMDNS) ListServices(_ ...registry.ListOption) ([]*registry.Service, error)

ListServices fetches all services in the registry.

func (*RegistryMDNS) Register

func (m *RegistryMDNS) Register(service *registry.Service, _ ...registry.RegisterOption) error

Register registes a service's nodes to the registry.

func (*RegistryMDNS) ServiceName

func (m *RegistryMDNS) ServiceName() string

ServiceName returns the configured name of this service.

func (*RegistryMDNS) ServiceVersion

func (m *RegistryMDNS) ServiceVersion() string

ServiceVersion returns the configured version of this service.

func (*RegistryMDNS) Start

func (m *RegistryMDNS) Start() error

Start the registry.

func (*RegistryMDNS) Stop

func (m *RegistryMDNS) Stop(_ context.Context) error

Stop the registry.

func (*RegistryMDNS) String

func (m *RegistryMDNS) String() string

String returns the plugin name.

func (*RegistryMDNS) Type

func (m *RegistryMDNS) Type() string

Type returns the component type.

func (*RegistryMDNS) Watch

func (m *RegistryMDNS) Watch(opts ...registry.WatchOption) (registry.Watcher, error)

Watch for registration changes.

Directories

Path Synopsis
Package client provides utility functions for the mdns registry.
Package client provides utility functions for the mdns registry.
Package dns provides mdns dns utilities.
Package dns provides mdns dns utilities.
Package server provides an MDNS server.
Package server provides an MDNS server.
Package util provides utilities.
Package util provides utilities.
Package zone provides mDNS zone utilities.
Package zone provides mDNS zone utilities.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL