mdns

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: Apache-2.0 Imports: 25 Imported by: 15

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 = "orb"
)

Defaults.

Functions

func Provide

func Provide(
	datas map[string]any,
	_ *types.Components,
	logger log.Logger,
	opts ...registry.Option,
) (registry.Type, error)

Provide 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(
	opts ...registry.Option,
) Config

NewConfig creates a new config object.

type Registry

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

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

func New

func New(cfg Config, log log.Logger) (*Registry, error)

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

func (*Registry) Deregister

func (m *Registry) Deregister(_ context.Context, node registry.ServiceNode) error

Deregister a service from the registry.

func (*Registry) GetService

func (m *Registry) GetService(ctx context.Context, namespace, region, name string, schemes []string) ([]registry.ServiceNode, error)

GetService fetches a service from the registry.

func (*Registry) ListServices

func (m *Registry) ListServices(ctx context.Context, namespace, region string, schemes []string) ([]registry.ServiceNode, error)

ListServices fetches all services in the registry.

func (*Registry) Register

func (m *Registry) Register(_ context.Context, serviceNode registry.ServiceNode) error

Register registes a service's nodes to the registry.

func (*Registry) Start

func (m *Registry) Start(ctx context.Context) error

Start the registry.

func (*Registry) Stop

func (m *Registry) Stop(ctx context.Context) error

Stop the registry.

func (*Registry) String

func (m *Registry) String() string

String returns the plugin name.

func (*Registry) Type

func (m *Registry) Type() string

Type returns the component type.

func (*Registry) Watch

func (m *Registry) Watch(ctx context.Context, 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